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

avoid writing and reparsing the artifact usage file once per artifact file in the project deps #4117

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

KristofferC
Copy link
Member

@KristofferC KristofferC commented Dec 17, 2024

When in doubt, do things in bulk

The timings below will vary depending on the size of the artifact usage log file but I guess my computer is somewhat representative:

julia> ENV["JULIA_PKG_PRECOMPILE_AUTO"] = 0
0

julia> Pkg.activate(; temp=true)

julia> @btime Pkg.add("Plots")
# master
  618.572 ms (4700447 allocations: 339.36 MiB)

# PR
  428.434 ms (3376261 allocations: 268.50 MiB)

Looking at a TimerOutput profile we can see how the runtime for download_artifacts changes:

Master:

───────────────────────────────────────────────────────────────────────────────────────────────
                                                      Time                    Allocations      
                                             ───────────────────────   ────────────────────────
              Tot / % measured:                   829ms /  99.4%            340MiB /  99.3%    

Section                              ncalls     time    %tot     avg     alloc    %tot      avg
───────────────────────────────────────────────────────────────────────────────────────────────
add                                       1    825ms  100.0%   825ms    338MiB  100.0%   338MiB
  add                                     1    825ms  100.0%   825ms    338MiB  100.0%   338MiB
...
    download_artifacts                    1    186ms   22.6%   186ms   75.8MiB   22.4%  75.8MiB
...
───────────────────────────────────────────────────────────────────────────────────────────────

PR:

───────────────────────────────────────────────────────────────────────────────────────────────
                                                      Time                    Allocations      
                                             ───────────────────────   ────────────────────────
              Tot / % measured:                   507ms /  99.6%            269MiB /  99.4%    

Section                              ncalls     time    %tot     avg     alloc    %tot      avg
───────────────────────────────────────────────────────────────────────────────────────────────
add                                       1    505ms  100.0%   505ms    267MiB  100.0%   267MiB
  add                                     1    505ms  100.0%   505ms    267MiB  100.0%   267MiB
...
    download_artifacts                    1   7.46ms    1.3%  7.46ms   7.38MiB    2.7%  7.38MiB
...    
───────────────────────────────────────────────────────────────────────────────────────────────

186ms -> 5.68 ms. 75 MB > 7.38 MB.

@IanButterworth
Copy link
Member

Sounds good. Any benefit of unique!-ing the list too?

@KristofferC
Copy link
Member Author

It is already a set when called from the artifacts code so probably not.

@KristofferC KristofferC merged commit b995782 into master Dec 17, 2024
7 checks passed
@KristofferC KristofferC deleted the kc/artifact_toml branch December 17, 2024 21:22
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.

3 participants