Migrate back to Cow for slightly improved performance#1
Merged
katrinafyi merged 1 commit intorina-forks:refactor-filecheckerfrom Aug 30, 2025
Merged
Conversation
|
Thanks for looking into it! I'll give it a try and see how it goes. Honestly, this is definitely micro-optimisation because I think |
katrinafyi
approved these changes
Aug 29, 2025
katrinafyi
left a comment
There was a problem hiding this comment.
Huh, I had assumed that using Cow would need more complicated code in assert_resolves. But even with the changed signature, it just works. I think there's some Deref magic happening here :D
I'll merge this next time I'm at the computer. Thanks!
katrinafyi
added a commit
that referenced
this pull request
Aug 30, 2025
…ing (lycheeverse#1830) * chore(file checker): separate resolving and checking for easier testing this does a simple refactor to break up the `check_path` function. previously, this had the responsibility of resolving index files/fallback extensions _and_ checking fragments. this was done in one step which made it hard to test - in order to test the resolving, we had to test it indirectly by checking fragments in certain files. this introduces a new `resolve_local_path` function which only applies the index file + extensions, so we can use this in unit tests and make assertions about the resolved path. this should have no changes to any behaviour. * rewrite tests to directly test resolve function this makes the meaning of the tests a bit clearer. rather than going through fragments, we can directly make assertions about the resolved file path. * lint * refactor(FileChecker): improve path resolution with Cow for better performance (#1) * extremely opinionated .map usage --------- Co-authored-by: Matthias Endler <matthias@endler.dev>
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.
There's a big chance that the performance difference does not matter, but since this happens in the hot path, I decided to give
Cowa try again. 🐮 Turns out it wasn't too awful and is contained within the function, so I'd argue it's worth it. But you'll be the judge. 😅 I'm okay either way.