0

Currently, I am benchmarking the running time of a package from the terminal. When I use a command with the same file repeatedly, running time was much less than the first one, and this made me think that there might be some 'caching' to make the terminal work faster and I should not trust the values other than the first one. I applied what described in this link and I run the line showed in the link before each run. After that, it seems like I don't get cached results, but now timing values keep increasing with each run, and it made me think that this is not a proper way to delete the cache or I miss something else. How can I reset the cache properly to have accurate results?

Batu
  • 1
  • 1
    There's no "terminal cache". Programs may run faster the 2nd and 3rd time because the content of files which they are reading are cached in ram by the operating system. Linux is using a "unified cache" for all the users & files and all kinds of access (via read, on-demand paging, etc), there's absolutely no way to only "reset the cache" for a process or session. –  Jul 16 '19 at 16:46
  • @mosvy so what does that link do exactly? – Batu Jul 17 '19 at 09:15
  • It trashes the whole data cached by the system (pagecache + fs metadata), causing it to be fetched from disk or network again when needed (This includes the binaries/executable programs themselves). Look for `drop_caches` in the `proc(5)` manpage. –  Jul 17 '19 at 16:52

0 Answers0