I run this command every time I build my project from the project directory:
egrep -r -n --include=*.java <my regex> .
And I cannot understand why consecutive runs are up to 10 times faster than first one. Actually I have seen this behavior in other disk IO operations involving large directories (calculation directory size, code commits etc.).
I think that it is related to operation system’s disk IO internals. Probably it is caching on some level. Can somebody point my nose in right direction?
Because recently accessed files are cached by the operating system.
Have a look here.