c - Handing out addresses in a custom memory allocator w.r.t. cache conflicts -



c - Handing out addresses in a custom memory allocator w.r.t. cache conflicts -

i've spent afternoon reading on processor caches after reading the effect powerfulness of twos can have on cache conflicts. wish apply new knowledge memory allocator multi-threaded programs. however, don't understand yet.

i under impression processors loved powers of two, allocator rounds requested sizes next powerfulness of 2 , slices pages multiples of size , hands them out. when page full, maps new page , slices same way. leads similar , predictable offsets pages.

to extent should adapt allocator avoid issue? example, should seek randomize addresses or screwed using powers of 2 in first place?

thanks!

until have uncontrovertible proof this performance critical, leave be. complication not worth it.

everybody should read (and understand!) bentley's "writing efficient programs" (sadly out of print now, "programming pearls" contains summary, , worth read too).

before embarking on code-optimization bout, create sure worth it. if performance adequate, there improve uses of time. yes, have measure first. measure cost beingness spent. programmers notoriously bad @ guessing costs are the performance gains come restating problem (sometimes plenty solve problem faster solve), overall organization of system, next improve algorithms/data structures; , @ very, end detail optimizations 1 considered here. your friendly compiler, given bit of prodding in direction of "generate code" today generate much improve code experienced assembly language programmer when given similar (full function scale) tasks. local source code reorganizations "for performance" either moot (the compiler have done on own) or deleterious (the compiler recognize , rewrite usual code sequences, unusual code can confuse nil or generate bad code). programmer time (writing, debugging, maintaining) much more valuable few microseconds of computer time here , there, except extremely unusual circumstances. write simplest code job, rework if experience shows worthwile.

c performance memory-management cpu-cache

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -