niyue commented on code in PR #40031:
URL: https://github.com/apache/arrow/pull/40031#discussion_r1485495850


##########
cpp/src/gandiva/tests/micro_benchmarks.cc:
##########
@@ -421,13 +421,13 @@ static void DoDecimalAdd2(benchmark::State& state, 
int32_t precision, int32_t sc
   ASSERT_OK(status);
 }
 
-static void TimedTestExprCompilation(benchmark::State& state) {
+static void TimedTestExprCompilation(benchmark::State& state, bool use_cache) {
   int64_t iteration = 0;
   for (auto _ : state) {
     // schema for input fields
     auto field0 = field("f0", int64());
     auto field1 = field("f1", int64());
-    auto literal = TreeExprBuilder::MakeLiteral(iteration);
+    auto literal = TreeExprBuilder::MakeLiteral(use_cache ? 1LL : iteration);

Review Comment:
   A new `use_cache` parameter is added to the benchmark, when `use_cache`, the 
expression is the same across iterations (a constant `1` is used), so that code 
cache will take effect during multiple times of projector construction.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to