lzbench icon indicating copy to clipboard operation
lzbench copied to clipboard

Timings ?

Open g1mv opened this issue 7 years ago • 3 comments

Are timings done by calculating the actual process time or an absolute time ? I'm just wondering as a quick look at the code made me think it might be the latter case. That could be problematic as a heavily or variably loaded test machine would generate distorted results.

g1mv avatar Feb 02 '18 23:02 g1mv

Time is measured with: QueryPerformanceCounter for Windows mach_absolute_time for macOS clock_gettime(CLOCK_MONOTONIC) for Linux

inikep avatar Feb 05 '18 11:02 inikep

This might be an issue then, because the timings cannot be reliable if anything else runs on the testing machine, as these functions do not count CPU times but absolute times. I actually encountered the problem a while ago and made a simple lib (cputime) to access multiplatform CPU times. Basically, on Linux and MacOS, you can use getrusage() and check the ru_utime value; and on Windows, GetProcessTimes() will give user time values as well. These functions are not microsecond accurate and are certainly less accurate than the ones you're using, but they have a big advantage which is not being dependent on the external load of your testing machine, i.e. should be immune to load variations and give consistent results. That's what should be expected from a benchmark application I suppose. What do you think ?

g1mv avatar Feb 05 '18 17:02 g1mv

Currently it works well (for lzbench and TurboBench) because we set realtime priority and assume that we are using only a single core. Glza is only compressor that uses multi-core but it's slow anyway. The task of comparing compression on multi-core is much harder.

inikep avatar Feb 06 '18 12:02 inikep