Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run OhMyREPL keybindings in a fixed world age #321

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

c42f
Copy link
Contributor

@c42f c42f commented Apr 27, 2023

Hopefully this should avoid most invalidations caused by loading other packages as discussed in JuliaLang/JuliaSyntax.jl#252.

Also refactor/replace the NEW_KEYBINDINGS global as it's hard to follow where this is added to, and surface a bunch of other uses of global variables like Base.active_repl up to the top level init.

I'm not sure whether there's some additional wrapping which is needed around the pirating in refresh_lines.jl, etc?

Seems to fix #316 ?

@jakobnissen You've used OhMyREPL a lot more than me, perhaps you could give this a test drive? I'm not entirely sure of all the ways I should be trying to test this.

@jakobnissen
Copy link
Contributor

This PR indeed removes all (noticable) latency even when running with JuliaSyntax 0.3.4 (before Kristoffer's recent type-stability improvements to JuliaSyntax) and importing ProgressLogging.

When using the latest JuliaSyntax, loading ProgressLogging still leads to 277 invalidations before your PR, and 253 with your PR. In either case, latency is not noticable even when the invalidated code is in the REPL - maybe I just can't figure out how to trigger the invalidated code to recompile.

Still, from a latency viewport this is a minor win. If there a no/few downsides, it looks good. If there are any downsides to running in a fixed world age, perhaps a better solution might be to make REPL.jl more type stable.

@c42f
Copy link
Contributor Author

c42f commented Apr 27, 2023

loading ProgressLogging still leads to 277 invalidations before your PR, and 253 with your PR

Right. This doesn't prevent invalidations in the latest world. But running the key bindings in an older world avoids the compiler having to do work to deal with them. So latency should be much improved.

@c42f c42f force-pushed the c42f/fixed-world-age branch 2 times, most recently from 6ece42b to b360ca4 Compare May 18, 2023 21:12
@codecov-commenter
Copy link

codecov-commenter commented May 18, 2023

Codecov Report

Patch coverage: 1.69% and project coverage change: -5.22 ⚠️

Comparison is base (0d60955) 56.88% compared to head (b360ca4) 51.67%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #321      +/-   ##
==========================================
- Coverage   56.88%   51.67%   -5.22%     
==========================================
  Files          15       13       -2     
  Lines        1111     1134      +23     
==========================================
- Hits          632      586      -46     
- Misses        479      548      +69     
Impacted Files Coverage Δ
src/BracketInserter.jl 1.09% <ø> (-20.02%) ⬇️
src/hooks.jl 0.00% <0.00%> (ø)
src/repl.jl 0.00% <0.00%> (-13.13%) ⬇️
src/OhMyREPL.jl 19.35% <5.26%> (-1.40%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@KristofferC
Copy link
Owner

Good to go?

@c42f
Copy link
Contributor Author

c42f commented May 18, 2023

I've updated this to also fix the world age of the pirated LineEdit.refresh_line, and to precompile the implementations of all pirated methods. This should reduce latency a little.

@c42f
Copy link
Contributor Author

c42f commented May 18, 2023

Oh I didn't see your comment. Yes, I think it's good to go now :-)

This should avoid most invalidations caused by loading other packages.

Also remove the NEW_KEYBINDINGS global as it's hard to follow where this
is added to.

Rearrange all overrides so the implementation code can be precompiled,
with the only thing which is `eval`d at runtime being the method
pirating itself.

Include global mutable "hook" binding for `LineEdit.refresh_line` to
allow us to fix the world age of the implementation.
@c42f
Copy link
Contributor Author

c42f commented Aug 9, 2024

Ugh this has gotten stale/conflicted.

I've fixed the conflicts and pushed again.

It would be nice to merge this? it contains improvements to precompilation, along with the invoke_in_world stuff.

@c42f
Copy link
Contributor Author

c42f commented Aug 9, 2024

Windows nightly test failures are probably due to JuliaDebug/TerminalRegressionTests.jl#14 ?

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.

Noticeable lag when importing with ProgressLogging.jl
4 participants