Skip to content

Comments

Refactor: Optimize StepIntersection by pre-calculating step timespans#2284

Merged
copybara-service[bot] merged 1 commit intomasterfrom
test_868015231
Feb 20, 2026
Merged

Refactor: Optimize StepIntersection by pre-calculating step timespans#2284
copybara-service[bot] merged 1 commit intomasterfrom
test_868015231

Conversation

@copybara-service
Copy link

@copybara-service copybara-service bot commented Feb 10, 2026

Refactor: Optimize StepIntersection by pre-calculating step timespans

Optimizes the StepIntersection constructor 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:

  • 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.

@copybara-service copybara-service bot force-pushed the test_868015231 branch 5 times, most recently from 5fe41ec to 851284a Compare February 16, 2026 05:41
@copybara-service copybara-service bot force-pushed the test_868015231 branch 2 times, most recently from dbccb3b to 84cde3e Compare February 20, 2026 07:32
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
@copybara-service copybara-service bot merged commit ec7ffef into master Feb 20, 2026
@copybara-service copybara-service bot deleted the test_868015231 branch February 20, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant