JuliaPy / PyCall.jl

Package to call Python functions from the Julia language
MIT License
1.47k stars 187 forks source link

Dict->IdDict in exception types #927

Closed timholy closed 2 years ago

timholy commented 2 years ago

Dicts use extensive specialization and this adds latency. IdDicts don't and are the go-to associative container for type-keys.

This one change reduces startup time by ~0.35s: in fresh sessions, with the package already precompiled, and --startup-file=no, master is

julia> tstart = time(); using PyCall; time() - tstart
1.188127040863037

whereas this branch is

julia> tstart = time(); using PyCall; time() - tstart
0.8567991256713867
timholy commented 2 years ago

xref https://discourse.julialang.org/t/what-does-jl-init-restored-modules-do-why-does-loading-my-package-take-so-long/69906

KristofferC commented 2 years ago

@tkf, @stevengj, could this be merged (or at least allow CI to run). It is a quite significant load time improvement.

codecov-commenter commented 2 years ago

Codecov Report

Merging #927 (146c1ec) into master (8a98fb4) will decrease coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #927      +/-   ##
==========================================
- Coverage   68.03%   68.02%   -0.01%     
==========================================
  Files          20       20              
  Lines        1980     2033      +53     
==========================================
+ Hits         1347     1383      +36     
- Misses        633      650      +17     
Flag Coverage Δ
unittests 68.02% <100.00%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/io.jl 83.33% <ø> (+0.23%) :arrow_up:
src/exception.jl 60.74% <100.00%> (-0.80%) :arrow_down:
src/pydates.jl 93.10% <0.00%> (-3.27%) :arrow_down:
src/pybuffer.jl 61.11% <0.00%> (-0.80%) :arrow_down:
src/pyarray.jl 70.00% <0.00%> (-0.55%) :arrow_down:
src/pyeval.jl 70.47% <0.00%> (-0.12%) :arrow_down:
src/gui.jl 0.00% <0.00%> (ø)
src/conversions.jl 63.32% <0.00%> (+<0.01%) :arrow_up:
src/pyclass.jl 96.72% <0.00%> (+0.05%) :arrow_up:
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8a98fb4...146c1ec. Read the comment docs.

tkf commented 2 years ago

LGTM!

The CI failures are unrelated (fixing it in #930)