Refactor: Optimize StepIntersection by pre-calculating step timespans#2284
Merged
copybara-service[bot] merged 1 commit intomasterfrom Feb 20, 2026
Merged
Refactor: Optimize StepIntersection by pre-calculating step timespans#2284copybara-service[bot] merged 1 commit intomasterfrom
copybara-service[bot] merged 1 commit intomasterfrom
Conversation
5fe41ec to
851284a
Compare
dbccb3b to
84cde3e
Compare
Optimizes the `StepIntersection` constructor by pre-calculating step timespans to avoid redundant calculations. This reduces the time complexity from O(H*S^2*C) to O(H*S*C + H*S^2), where: * H = Number of hosts * S = Number of steps * C = Number of cores **Benchmark Results** (16 hosts, 100 steps, 8 cores) | Metric | Before Optimization | After Optimization | Improvement | | :--- | :--- | :--- | :--- | | Mean Time | 4,838,354 ns (~4.8 ms) | 243,417 ns (~0.24 ms) | **~19.87x speedup** | | Stddev | 79,165 ns | 2,552 ns | | **Real Profile Performance** Tested with 500mb x 8 (approx. 61,000 steps each). * **Total Time:** Reduced from ~12h 22m to ~53m. * **Latency:** Reduced from ~44,554s to ~3,186s. * **Speedup:** ~14x for an actual profile. PiperOrigin-RevId: 872760689
84cde3e to
ec7ffef
Compare
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.
Refactor: Optimize StepIntersection by pre-calculating step timespans
Optimizes the
StepIntersectionconstructor by pre-calculating step timespans to avoid redundant calculations.This reduces the time complexity from O(HS^2C) to O(HSC + H*S^2), where:
Benchmark Results
(16 hosts, 100 steps, 8 cores)
Real Profile Performance
Tested with 500mb x 8 (approx. 61,000 steps each).