Thanks to visit codestin.com
Credit goes to github.com

Skip to content

don't isTest-check entire deepTerms on view/edit - #4520

Merged
aryairani merged 1 commit into
trunkfrom
cp/speedup-view-edit
Dec 19, 2023
Merged

aryairani merged 1 commit into
trunkfrom
cp/speedup-view-edit

Conversation

@ChrisPenner

@ChrisPenner ChrisPenner commented Dec 16, 2023

Copy link
Copy Markdown
Member

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 view and edit get a big speedup!

Implementation notes

edit checks whether a definition is a test so that we can render it with test> 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.

@ChrisPenner ChrisPenner self-assigned this Dec 16, 2023
@ChrisPenner
ChrisPenner marked this pull request as ready for review December 16, 2023 04:51
@ChrisPenner
ChrisPenner marked this pull request as draft December 16, 2023 04:51
@aryairani

aryairani commented Dec 16, 2023

Copy link
Copy Markdown
Contributor

Whoops, good catch.

Wdyt of the smaller change of just substituting the requested terms in place of Branch.deepTerms?

@pchiusano

Copy link
Copy Markdown
Member

Amazing!

@ChrisPenner
ChrisPenner marked this pull request as ready for review December 19, 2023 20:52
@ChrisPenner

Copy link
Copy Markdown
Member Author

I removed the dependency on the fuzzy-finder PR so this is ready to merge ASAP :)

@aryairani aryairani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice!

@aryairani aryairani changed the title Huge speedup to View and Edit don't isTest-check entire deepTerms on view/edit Dec 19, 2023
@aryairani
aryairani merged commit 87fdb13 into trunk Dec 19, 2023
@aryairani
aryairani deleted the cp/speedup-view-edit branch December 19, 2023 22:00
@ceedubs

ceedubs commented Dec 20, 2023

Copy link
Copy Markdown
Contributor

Wow ucm felt so much snappier today and I wondered what changed and found this in the merged PRs. Amazing. Thanks @ChrisPenner!

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.

4 participants