don't isTest-check entire deepTerms on view/edit - #4520
Merged
Merged
Conversation
ChrisPenner
marked this pull request as ready for review
December 16, 2023 04:51
ChrisPenner
marked this pull request as draft
December 16, 2023 04:51
Contributor
|
Whoops, good catch. Wdyt of the smaller change of just substituting the requested terms in place of |
Member
|
Amazing! |
ChrisPenner
force-pushed
the
cp/speedup-view-edit
branch
from
December 19, 2023 20:49
2b665da to
a4949ee
Compare
ChrisPenner
marked this pull request as ready for review
December 19, 2023 20:52
Member
Author
|
I removed the dependency on the fuzzy-finder PR so this is ready to merge ASAP :) |
isTest-check entire deepTerms on view/edit
Contributor
|
Wow ucm felt so much snappier today and I wondered what changed and found this in the merged PRs. Amazing. Thanks @ChrisPenner! |
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.
Overview
Stew mentioned pretty-printing was getting slow, it really was.
Turns out it wasn't pretty-printing at all, we were checking if the definition was a test in a pretty inefficient way (likely hasn't been changed since the view command was written, and people didn't have much code back then).
Anyways, that was pretty easy to fix and
viewandeditget a big speedup!Implementation notes
editchecks whether a definition is a test so that we can render it withtest>in scratchfiles, fair enough,however the way it was checking was to load EVERY definition in the entire namespace (including transitive libs), THEN encode and pass that entire set of refs to SQLite, looking at the type of each of them to find which ones are tests.
The new version only loads the terms we're actually viewing/editing, so it's O(n) rather than O(transitive namespace).
Interesting/controversial decisions
I'm thinking one of these weeks we should just bite the bullet and kill
deepTerms, it's tempting to use because it's convenient, but it's a huge performance footgun :'(Test coverage
Existing transcripts should test this pretty well.
Loose ends
Nope.