Skip to content

Conversation

@SyMind
Copy link
Collaborator

@SyMind SyMind commented Oct 30, 2025

This PR refactors ReplaceSource to maintain a sorted list of replacements eagerly instead of using lazy sorting with atomic synchronization. The main changes eliminate the itertools dependency and simplify the concurrency model.

  • Removes lazy sorting mechanism with Mutex and AtomicBool in favor of maintaining sorted order on insertion
  • Adds an index field to Replacement struct to preserve insertion order as a tiebreaker in sorting
  • Removes dependency on itertools crate

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 30, 2025

CodSpeed Performance Report

Merging #194 will improve performances by 34.97%

Comparing perf-replace-source-data-struct (8dfc462) with main (c5b3502)

Summary

⚡ 2 improvements
✅ 9 untouched
⏩ 5 skipped1

Benchmarks breakdown

Benchmark BASE HEAD Change
complex_replace_source_size 294.1 µs 217.9 µs +34.97%
repetitive_react_components_source 519.5 µs 469.2 µs +10.73%

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@SyMind SyMind marked this pull request as ready for review October 30, 2025 07:12
Copilot AI review requested due to automatic review settings October 30, 2025 07:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors ReplaceSource to maintain a sorted list of replacements eagerly instead of using lazy sorting with atomic synchronization. The main changes eliminate the itertools dependency and simplify the concurrency model.

  • Removes lazy sorting mechanism with Mutex and AtomicBool in favor of maintaining sorted order on insertion
  • Adds an index field to Replacement struct to preserve insertion order as a tiebreaker in sorting
  • Removes dependency on itertools crate

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/replace_source.rs Refactored to maintain sorted replacements eagerly using binary search on insertion, removed lazy sorting infrastructure, added Ord/PartialOrd implementations for Replacement, updated hash test expectation
Cargo.toml Removed itertools dependency
Cargo.lock Removed itertools 0.13.0 entry from dependency tree

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SyMind SyMind merged commit c4f7e16 into main Oct 30, 2025
10 checks passed
@SyMind SyMind deleted the perf-replace-source-data-struct branch October 30, 2025 07:27
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.

2 participants