Reranko05 opened a new pull request, #49900:
URL: https://github.com/apache/arrow/pull/49900

   ### Rationale for this change
   
   This PR extracts a reduced-scope optimization from the earlier work in 
#40031, focusing specifically on selective external C function mapping during 
Gandiva engine initialization.
   
   Currently all external C stubs are registered eagerly, even when an 
expression only uses a small subset of functions. This change delays Engine 
initialization until expression decomposition has collected the functions 
actually used by the expression set, then registers only those functions (plus 
required internal helpers).
   
   Local microbenchmarks show a modest improvement (~1–2% in 
TimedTestNonBitcodeExprCompilationNoCache), consistent with observations 
reported in #40031.
   
   ### What changes are included in this PR?
   
   - Implement the selective C-function mapping.
   - Track functions used during expression decomposition.
   - Delay Engine initialization until used functions are known.
   - Skip registration of unused external C function mappings.
   - Add compilation microbenchmarks to evaluate this optimization.
   
   ### Are these changes tested?
   
   Yes.
   
   - Added/used compilation microbenchmarks to compare behavior before and 
after the optimization.
   - Benchmarks were run repeatedly (20-run CPU-time comparison) and showed 
modest (~1–2%) positive improvement.
   
   ### Benchmark results
   
   <img width="320" height="240" alt="arrow_pr" 
src="https://github.com/user-attachments/assets/9df288d3-5f4c-4288-92d5-222870352cb0";
 />
   
   
   Figure: Distribution of CPU time for 
TimedTestNonBitcodeExprCompilationNoCache across 20 runs
   
   ### Are there any user-facing changes?
   
   No


-- 
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