Apply ConsecutiveSlice optimizations to CompiledSimulation for ~46% reduction in compile time.#495
Merged
Merged
Conversation
…% reduction in compile time. For pyrtlnet, this reduces `CompiledSimulation`'s startup time from 2.96 seconds to 1.6 seconds. It does not affect simulation speed, so the compiler was optimizing the inefficient code we were generating before, but we were paying for those optimizations with startup time. Also: Simplify the interface for `make_contiguous_slices` and move the `shift` helper in `simulation.py` to toplevel so we can call it from `compilesim.py`. Add some comments and emit bitmasks in hex so they're easier to identify.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## development #495 +/- ##
=============================================
+ Coverage 92.2% 92.2% +0.1%
=============================================
Files 30 30
Lines 7465 7488 +23
=============================================
+ Hits 6876 6902 +26
+ Misses 589 586 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Example: the old code would generate: while the new code generates: |
"Consecutive" is more correct, because it implies an in-order sequence with unit spacing, which is what we're modeling. https://mathworld.wolfram.com/ConsecutiveNumbers.html
ContiguousSlice optimizations to CompiledSimulation for ~46% reduction in compile time.ConsecutiveSlice optimizations to CompiledSimulation for ~46% reduction in compile time.
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.
For pyrtlnet, this reduces
CompiledSimulation's startup time from 2.96 seconds to 1.6 seconds. It does not affect simulation speed, so the compiler was optimizing the inefficient code we were generating before, but we were paying for those optimizations with startup time.Also: Simplify the interface for
make_consecutive_slicesand move theshifthelper insimulation.pyto toplevel so we can call it fromcompilesim.py. Add some comments and emit bitmasks in hex so they're easier to identify.