Skip to content

Comments

Move REPL support into a package extension#978

Open
JamesWrigley wants to merge 3 commits intotimholy:masterfrom
JamesWrigley:repl
Open

Move REPL support into a package extension#978
JamesWrigley wants to merge 3 commits intotimholy:masterfrom
JamesWrigley:repl

Conversation

@JamesWrigley
Copy link
Contributor

The main reason for this is to make Revise a bit more light-weight for packages that only need the revision API, and to reduce the overhead of loading Revise by default outside of the REPL. The load time when loaded without the REPL is almost halved:

# Master
$ julia --startup-file=no --project -e '@time import Revise'                                                                                                                                                           
  0.319723 seconds (404.29 k allocations: 27.255 MiB)

# PR
$ julia --startup-file=no --project -e '@time import Revise'                                                                                                                                                             
  0.182584 seconds (314.75 k allocations: 21.336 MiB)

I also renamed the Distributed extension in 8d4a07f to make it easier to distinguish where the extension module comes from.
Written with help from Claude 🤖

In some cases Pkg still prints the extension name without the parent package
name, which can make debugging tricky.
@JamesWrigley
Copy link
Contributor Author

(rebased to fix merge conflicts)

@JamesWrigley
Copy link
Contributor Author

(bump)

1 similar comment
@JamesWrigley
Copy link
Contributor Author

(bump)

@aviatesk
Copy link
Collaborator

Loading Revise even when not starting a REPL seems to be a startup-file issue on the user side. So I agree with the optimization in this PR, but I have concerns about whether the added complexity required to support package extensions is actually justified by the benefits.

@JamesWrigley
Copy link
Contributor Author

My motivation isn't actually the startup time, it's making Revise more lightweight to use in other libraries that don't need the REPL (i.e. mine 😛). But I do understand the complexity concern. Having to load the REPL would be unfortunate but not a deal breaker for me, so I leave the final decision to you :)

@aviatesk
Copy link
Collaborator

Actually, I need to do something similar to your use case (calling Revise from a library that doesn't need REPL). Specifically, I'll be calling Revise's subcomponents from JETLS, so I'll need this kind of mechanism in the But if we use the package extension method, these codes would be automatically loaded by packages that load REPL no matter if the package want to use this REPL extension, which might cause a different problem. Or, maybe we should just refactor Revise subcomponents into something like ReviseCore.jl, by defining reasonable subcomponents of Revise that can be used independently. This change wouldn't affect its design.

@JamesWrigley
Copy link
Contributor Author

Having a ReviseCore also sounds good to me 👍 I'm happy to take a shot at it if you prefer that over a package extension.

@JamesWrigley
Copy link
Contributor Author

Shall I make a ReviseCore?

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.

2 participants