Thursday, January 16, 2014

The Lost Art of C Structure Packing

The Lost Art of C Structure Packing (by Eric Raymond):

There are ways to reduce memory usage significantly in situations like this, by rearranging the order of structure members in careful ways. This can lead to dramatic gains - in my case I was able to cut the working-set size by around 40%, enabling the program to handle much larger repositories without dying.

2 Comments RSS · Twitter

I wonder how that applies to ObjectiveC? In the old and new runtimes?

@Charles Yeah, I’m not sure whether that’s documented. I assume that if you put whatever you want to pack into a struct ivar (as I think AppKit does), it won’t mess up what’s inside.

Leave a Comment