News for hackers. Stuff that matters.
Re:What I learned from my first C coding challenge by twoodfin on Tuesday September 04, 2012 @03:13PM (#4476060)
More specifically, a pointer in x86-64 (and most other 64-bit architectures) is going to be 8-byte aligned, which means that a struct of an 8-byte pointer plus a 2-byte short will actually consume 16 bytes.

Alternatively, keeping them in separate arrays removes the alignment overhead, and each pair of values will consume 10 bytes. That's a substantial savings when you're trying to fit into something like a 32KB L1 data cache.

Another technique that can help you fit as much useful data as possible into L1/L2 cache is to store offsets rather than raw pointers. Using a 2-byte unsigned short for an offset rather than an 8-byte pointer would save another 6 bytes of cache per entry, assuming you're happy limiting your URL size to 64 kilobytes. The extra address arithmetic should be essentially free on a modern pipeline.

Re:What I learned from my first C coding challenge by jparishy on Tuesday September 04, 2012 @03:15PM (#4476069)
I was hoping someone would fill in the details; it's been quite a while since I've dealt with anything like that. Thanks!
Re:What I learned from my first C coding challenge by Keyframe on Tuesday September 04, 2012 @03:36PM (#4476159)
AoS vs SoA strikes again?
Re:What I learned from my first C coding challenge by jasonmoo on Tuesday September 04, 2012 @03:22PM (#4476090)
Thanks guys. This is great info. I messed around with different types for the length value in the struct. Figured something like this was involved.