Skip to content

Commit

Permalink
Make Distributed support a package extension
Browse files Browse the repository at this point in the history
This shaves off ~180ms from loading, though it does require Julia 1.9+.
  • Loading branch information
JamesWrigley committed Aug 20, 2024
1 parent fe4d02c commit f43ecbf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
11 changes: 9 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ authors = ["Nicholas Bauer <[email protected]>"]
version = "0.2.3"

[deps]
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"

[weakdeps]
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[extensions]
DistributedExt = ["Distributed"]

[compat]
julia = "1.6"
Distributed = "1"
REPL = "1"
julia = "1.9"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
__precompile__(false)
module DistributedExt

import Base:
showerror
__precompile__(false)

import Distributed:
myid,
RemoteException

# copied from Distributed/process_messages.jl and added dealing with RemoteException
function showerror(io::IO, re::RemoteException)
function Base.showerror(io::IO, re::RemoteException)
(re.pid != myid()) && print(io, "On worker ", re.pid, ":\n")
showerror(IOContext(io, :compacttrace => false), re.captured)
end
end

end
1 change: 0 additions & 1 deletion src/AbbreviatedStackTraces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ include("override-errorshow.jl")
include("override-show.jl")
include("override-stacktraces.jl")
include("override-REPL.jl")
include("override-Distributed-process_messages.jl")

import Base:
printstyled,
Expand Down

0 comments on commit f43ecbf

Please sign in to comment.