SURYAS1306 opened a new pull request, #823:
URL: https://github.com/apache/iceberg-cpp/pull/823

   ## Summary
   
   This PR implements the filtering hot-path optimization and benchmark 
infrastructure proposed in #690.
   
   - Replace `RETURN_IF_NOT_REFERENCE` with `BIND_REFERENCE_OR_RETURN` in 
`StrictMetricsEvaluator` so predicate handlers reuse the `dynamic_cast` result 
instead of calling `expr->reference()` (which bumps `shared_ptr` refcounts via 
`shared_from_this()`).
   - Add an off-by-default `ICEBERG_BUILD_BENCHMARKS` CMake option that fetches 
Google Benchmark (v1.9.1) and builds `strict_metrics_evaluator_bench`.
   
   ## Motivation
   
   `StrictMetricsEvaluator` runs once per data file during scan planning. The 
previous macro discarded a successful `dynamic_cast` and then re-fetched the 
same reference through a virtual call + atomic refcount operation on every 
predicate handler (14+ predicate types).
   
   ## Benchmark results (Release, Apple Clang 17, macOS)
   
   Micro-benchmark model of the predicate binding hot path:
   
   | Benchmark | Before | After | Gain |
   |---|---|---|---|
   | Single predicate | 21.0 ns | 12.4 ns | 1.69× |
   | 14 preds / file | 206 ns | 113 ns | 1.82× |
   | 20 preds / file | 294 ns | 160 ns | 1.84× |
   
   End-to-end `StrictMetricsEvaluator::Evaluate` benchmark (with binding + 
evaluation):
   
   | Predicates | Time |
   |---|---|
   | 1 | ~137 ns |
   | 14 | ~2.3 µs |
   | 20 | ~3.3 µs |
   
   ## Test plan
   
   - [x] `expression_test --gtest_filter='StrictMetrics*'` (42 tests pass)
   - [x] Build with `-DICEBERG_BUILD_BENCHMARKS=ON`
   - [x] Run `./benchmark/strict_metrics_evaluator_bench`
   
   Closes #690


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to