Further improve C++ logging for many individual log calls by introducing a component type registry #4296
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
As expected, not doing the C++ datatype -> C FFI schema -> Rust datatype roundtrip for each log call helps perf quite a bit, especially when we do a lot of smaller log calls.
The registry a single RwLock protected Vec (we never deregister) which is exposed via a single c entry point.
On the C++ side we use the local
static
variable mechanism for threadsafe lazy registration (slight codegen adjustment).Indicator components had some special handling before and were refactored to fit in this system - in the process I made their arrow array shared across all instantiations, further cutting down on per-log work.
Benchmark results:
0.15s
->0.14s
7.52s
->4.52s
0.57s
->0.51s
Old values from previous PR. New values are median over three runs, single executable run (this makes more and more of a difference with all these registries!), timings without prepare step, same M1 macbook.
A quick look over the profiler for running
log_benchmark points3d_many_individual
in isolation tells us that of the actual benchmark running time we spend..rr_recording_stream_log
(of which in turn 20%, so 7% overall, is still arrow FFI translation of the array!!)to_data_cell
methods(taken via
Instruments
on my Mac)Checklist