perf(oxfmt): make time measurement conditional#16634
Merged
graphite-app[bot] merged 1 commit intomainfrom Dec 9, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes performance in oxfmt by making time measurement conditional on the output mode. The Instant::now() call is now only executed in --check mode where timing information is actually displayed, eliminating unnecessary overhead in --write and --list-different modes.
Key changes:
- Conditional time measurement using lazy evaluation with
.then(Instant::now) - Moved elapsed time calculation from unconditional (line 74) to only when needed in Check mode (line 94)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Merge activity
|
leaysgur
approved these changes
Dec 9, 2025
## Summary - Make time measurement conditional based on output mode to reduce unnecessary overhead - `Instant::now()` is only called when using `--check` mode - Elapsed time calculation moved to only when it's actually displayed ## Test plan - [ ] Verify timing information still appears correctly in `--check` mode - [ ] Confirm no timing overhead in `--write` mode - [ ] Confirm no timing overhead in `--list-different` mode - [ ] Run `cargo check -p oxfmt` passes - [ ] Run `just fmt` completes successfully 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1c50560 to
10b4f9f
Compare
Copilot AI
pushed a commit
that referenced
this pull request
Dec 10, 2025
## Summary - Make time measurement conditional based on output mode to reduce unnecessary overhead - `Instant::now()` is only called when using `--check` mode - Elapsed time calculation moved to only when it's actually displayed ## Test plan - [ ] Verify timing information still appears correctly in `--check` mode - [ ] Confirm no timing overhead in `--write` mode - [ ] Confirm no timing overhead in `--list-different` mode - [ ] Run `cargo check -p oxfmt` passes - [ ] Run `just fmt` completes successfully 🤖 Generated with [Claude Code](https://claude.com/claude-code)
taearls
pushed a commit
to taearls/oxc
that referenced
this pull request
Dec 11, 2025
## Summary - Make time measurement conditional based on output mode to reduce unnecessary overhead - `Instant::now()` is only called when using `--check` mode - Elapsed time calculation moved to only when it's actually displayed ## Test plan - [ ] Verify timing information still appears correctly in `--check` mode - [ ] Confirm no timing overhead in `--write` mode - [ ] Confirm no timing overhead in `--list-different` mode - [ ] Run `cargo check -p oxfmt` passes - [ ] Run `just fmt` completes successfully 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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
Instant::now()is only called when using--checkmodeTest plan
--checkmode--writemode--list-differentmodecargo check -p oxfmtpassesjust fmtcompletes successfully🤖 Generated with Claude Code