aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/timer_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-06-29 16:39:22 +0200
committerGitHub <noreply@github.com>2019-06-29 16:39:22 +0200
commite2ce5ff9d6168de0ffaf59d6bf20f20631a34a2d (patch)
tree937e9bb7204b5ed160feba358a95d5e036cedc7c /test/functional/eval/timer_spec.lua
parent23a97949206bbe7dbbd3f7581bb2a24fabce116e (diff)
downloadrneovim-e2ce5ff9d6168de0ffaf59d6bf20f20631a34a2d.tar.gz
rneovim-e2ce5ff9d6168de0ffaf59d6bf20f20631a34a2d.tar.bz2
rneovim-e2ce5ff9d6168de0ffaf59d6bf20f20631a34a2d.zip
viml/profile: switch to uv_gettimeofday() #10356
Performance of high-resolution time (clock_gettime via uv_hrtime) is expensive on some systems. For profiling VimL, syntax, etc., we don't care about nanosecond-precision and monotonicity edge-cases, so avoid uv_hrtime(). closes #10328 From the uv__hrtime() source: https://github.com/libuv/libuv/blob/0cdb4a5b4b706d0e09413d9270da28f9a88dc083/src/unix/linux-core.c#L442-L462 /* Prefer CLOCK_MONOTONIC_COARSE if available but only when it has * millisecond granularity or better. CLOCK_MONOTONIC_COARSE is * serviced entirely from the vDSO, whereas CLOCK_MONOTONIC may * decide to make a costly system call. */ This micro-benchmark (Debug build) shows negligible differences on my system: #include <sys/time.h> ... proftime_T tm = profile_start(); int trials = 999999; int64_t t = 0; struct timeval tv; for (int i = 0; i < trials; i++) { t += gettimeofday(&tv,NULL); } tm = profile_end(tm); ILOG("%d trials of gettimeofday: %s", trials, profile_msg(tm)); tm = profile_start(); for (int i = 0; i < trials; i++) { t += os_hrtime(); } tm = profile_end(tm); ILOG("%d trials of os_hrtime: %s", trials, profile_msg(tm)); tm = profile_start(); for (int i = 0; i < trials; i++) { t += os_utime(); } tm = profile_end(tm); ILOG("%d trials of os_utime: %s", trials, profile_msg(tm)); ILOG("%zu", t);
Diffstat (limited to 'test/functional/eval/timer_spec.lua')
0 files changed, 0 insertions, 0 deletions