This is normal behavior. One way to avoid this problem is to warm up a bit before the main launch. These warm-ups will overwrite the cache that grew earlier running the program. When calculating the average value, exclude warm-up values ββfor a real run only. There are various notes tools that use this approach. kernbench , lmbench etc. Where the warm value is available.
And, if the benchmark that you use depends on the data you need to read from the disk, then disk caching also has some effect, one way to avoid this is, if possible, caching this data on RAM. This method is used by kernbench to avoid disk cache problems.
source share