Hi, Sergey,

thanks for the patch! See my comments.

Sergey

On 10/24/25 14:00, Sergey Kaplun wrote:
This patch introduces the `LUAJIT_BENCH_INIT` option to determine the

it is actually a runner for benchmark, not a command that runs before the benchmark itself.

Please rephrase.


I would rename a cmake option appropriately. LUAJIT_BENCH_EXEC/LUAJIT_BENCH_RUNNER?

Feel free to keep as is, I don't insist.

shell command to be run before the benchmark itself. It may be useful to
set taskset, etc.
---
 perf/CMakeLists.txt | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/perf/CMakeLists.txt b/perf/CMakeLists.txt
index 68e561fd..c315597f 100644
--- a/perf/CMakeLists.txt
+++ b/perf/CMakeLists.txt
@@ -7,6 +7,13 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
                   "Timings may be affected.")
 endif()
 
+# The shell command needs to be run before benchmarks are started.
+if(LUAJIT_BENCH_INIT)
+  message(STATUS
+    "The following command will run before benchmarks: '${LUAJIT_BENCH_INIT}'."
+  )
+endif()
this message is not necessary, one can see it in "ctest -V" output
+
 set(PERF_OUTPUT_DIR ${PROJECT_BINARY_DIR}/perf/output)
 file(MAKE_DIRECTORY ${PERF_OUTPUT_DIR})
 
@@ -51,7 +58,7 @@ macro(AddBench bench_name bench_path perf_suite LUA_PATH)
   set(bench_out_file
     ${PERF_OUTPUT_DIR}/${perf_suite}/${bench_name_stripped}.json
   )
-  set(bench_command "${LUAJIT_BINARY} ${bench_path}")
+  set(bench_command "${LUAJIT_BENCH_INIT} ${LUAJIT_BINARY} ${bench_path}")
   if(${ARGC} GREATER 4)
     set(input_file ${ARGV4})
     set(bench_command "${bench_command} < ${input_file}")