perf: cache phasor sample interval#81
Open
txbrown wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
1 / sr) whenPhasorNodeis constructed so each tick avoids spelling the reciprocal division in the hot pathphasorandsphasoroutput behavior, including sync reset handlingPart of #8.
Performance evidence
Measured locally on macOS with AppleClang, Release (
-O3/NDEBUG) native builds. The benchmark runs 512-sample blocks and reports median throughput across repeated runs.mainmedian samples/secphasorsphasorResult: this benchmark does not prove a stable material speedup in optimized builds. The likely explanation is that the compiler can already hoist or strength-reduce the invariant reciprocal in this tight benchmark. The PR still makes the intended invariant explicit and adds a benchmark target to keep future quick-perf work measurable.
Reproduction commands:
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./out/ ../.. cmake --build . --target runtime_benchmarks --config Release -j 8 ./runtime/runtime_benchmarks 512 500000 7Test plan
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./out/ ../..cmake --build . --config Release -j 8ctest --output-on-failure./build/native/runtime/runtime_benchmarks 512 500000 7