Jim's Depository

this code is not written
 

Benchmarking a machine with a surplus of RAM introduces a difference between the first run and subsequent runs when any disk blocks needed are already cached. Fortunately, since 2.6.16 there is a mechanism to discard the caches, /proc/sys/vm/drop_caches.

I use this command to drop my caches between benchmark runs.

sync ; echo 3 > /proc/sys/vm/drop_caches

Note: that command was simplified thanks to anonymous’ comment.

As an example, building femtodns currently takes 2.1 seconds with flushed caches and 0.9 seconds on subsequent runs.

You can read more about /proc/sys/vm/drop_caches at Drop Caches - linux-mm.org Wiki

You don't need to echo 1, 2, and 3.  As the page you link to makes clear, it's a bit-mask.  Echoing 3 alone is succifient after the sync.