When I execute cp folder1 folder2 -rf
,for the first time it takes around 10 mins. But when it I execute the second command cp folder1 folder3 -rf
, it takes around 1 min. folder1
contains about 100 000 files.
Why is there run time improvement for the second time?
This is because of page caching. Run sync ; echo 3 > /proc/sys/vm/drop_caches
to make it slow again.
Further reading: