@ Alexey Suslikov <alexey.susli...@gmail.com> wrote (2011-06-01 21:04+0200): > Why do they need such a trick instead of simply storing tags in a > associative array, where key is a pointer and value is a set of tags > (or any other arbitrary data)? Lookup against properly aligned array > is relatively fast. Am I missing something?
May i answer this. One reason is of course space consumption. If you have 10000 objects you need 10000 hash nodes and i don't know how many indices the array shall have in this situation. And also, following a pointer chain is poison for CPU cache housekeeping. I.e. in that meaningless example // _area->owner->cbin_table[u.cbin->cbin_index] = u.cbin; you have to wait multiple times for memory to become available. And this is *really* expensive! -- Ciao, Steffen sdaoden(*)(gmail.com) () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments