[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: abundant memory?

From: Bruno Haible
Subject: Re: abundant memory?
Date: Thu, 24 Jul 2008 00:49:25 +0200
User-agent: KMail/1.5.4

Jim Meyering wrote:
> This sounds like an obvious win for linkedhash-list, in these days of
> inexpensive RAM and the 8GB hobby system.  Back when I wrote hash.c,
> data structure size was the primary constraint in the computational
> geometry applications I cared about.

Small data structure sizes are still important, because of memory caches:
There is usually a level-1 cache near the CPU, then a level-2 cache, and then
only comes the main memory measured in gigabytes. The level-1 cache is often
only a few kilobytes large. You can consider that a memory access to an
uncached memory location is about 6-8 times slower than a memory access to
cached memory. (*)

So, the smaller the data structures, the faster your program will be.
Bit fields are *not* outdated!


(*) These figures were gained through two experiments:
    1) Put RAM into memory locations that are not cached by the mainboard
       logic, and compare the speed of programs running in these memory areas
       to the speed of the same programs in the normal configuration.
    2) Compare a algorithm that does computations on few objects in memory
       with the same algorithm applied to a huge number of alike objects,
       accessed in random order.
    If you have similar experiments or other results, I would love to hear
    about it.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]