From 1b664dd87084ec8614371ea951791b10533b83c2 Mon Sep 17 00:00:00 2001 From: Jude Melton-Houghton Date: Sun, 19 Dec 2021 08:41:08 -0500 Subject: [PATCH] Use defined evaluation order in profiler See https://github.com/LuaJIT/LuaJIT/issues/238 --- builtin/profiler/instrumentation.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/builtin/profiler/instrumentation.lua b/builtin/profiler/instrumentation.lua index 6b951a2c2..f80314b32 100644 --- a/builtin/profiler/instrumentation.lua +++ b/builtin/profiler/instrumentation.lua @@ -102,8 +102,9 @@ local function instrument(def) -- also called https://en.wikipedia.org/wiki/Continuation_passing_style -- Compared to table creation and unpacking it won't lose `nil` returns -- and is expected to be faster - -- `measure` will be executed after time() and func(...) - return measure(modname, instrument_name, time(), func(...)) + -- `measure` will be executed after func(...) + local start = time() + return measure(modname, instrument_name, start, func(...)) end end