cvs commit: src/lib/libc/stdlib malloc.c

Jason Evans jasone at FreeBSD.org
Sat Jul 1 16:51:12 UTC 2006


jasone      2006-07-01 16:51:11 UTC

  FreeBSD src repository

  Modified files:
    lib/libc/stdlib      malloc.c 
  Log:
  Use some math tricks in arena_run_reg_dalloc() to avoid actual division, as
  well as avoiding a switch statement.  This change has no significant impact
  to performance when branch prediction is successful at predicting the sizes
  of objects passed to free(), but in the case that the object sizes are
  semi-random, this change has the potential to prevent many branch prediction
  misses, thus improving performance substantially.
  
  Take advantage of alignment guarantees in ipalloc(), and pad object sizes to
  something less than a power of two when possible.  This has the potential
  to substantially reduce internal fragmentation for objects allocated via
  posix_memalign().
  
  Avoid an unnecessary pow2_ceil() call in arena_ralloc().
  
  Submitted by:   djam8193ah at hotmail.com
  
  Revision  Changes    Path
  1.129     +90 -83    src/lib/libc/stdlib/malloc.c


More information about the cvs-src mailing list