Skip to content

Add precompilation workload#252

Merged
amontoison merged 3 commits intomainfrom
gd/precompilation
May 26, 2025
Merged

Add precompilation workload#252
amontoison merged 3 commits intomainfrom
gd/precompilation

Conversation

@gdalle
Copy link
Copy Markdown
Member

@gdalle gdalle commented May 3, 2025

This speeds up time-to-first-plot tremendously.

Benchmark (to run in a fresh Julia session):

using LinearAlgebra, Random, SparseArrays
using SparseMatrixColorings

# simple task
@time begin
    A = sprand(MersenneTwister(0), Bool, 10, 10, 0.2)
    problem = ColoringProblem(; structure=:nonsymmetric, partition=:column)
    algo = GreedyColoringAlgorithm(; decompression=:direct)
    result = coloring(A, problem, algo)
    B = compress(A, result)
    decompress(B, result)
end;

# complicated task
@time begin
    A = sprand(MersenneTwister(0), Bool, 10, 10, 0.2)
    problem = ColoringProblem(; structure=:nonsymmetric, partition=:bidirectional)
    algo = GreedyColoringAlgorithm(; decompression=:substitution, postprocessing=true)
    result = coloring(A, problem, algo)
    Br, Bc = compress(A, result)
    decompress(Br, Bc, result)
end;

With precompilation:

  • Simple task: 0.000096 seconds (108 allocations: 26.328 KiB)
  • Complicated task: 0.003747 seconds (1.81 k allocations: 112.008 KiB, 98.13% compilation time)

Without precompilation:

  • Simple task: 0.394682 seconds (2.78 M allocations: 141.290 MiB, 1.76% gc time, 99.95% compilation time)
  • Complicated task: 0.896819 seconds (3.00 M allocations: 154.698 MiB, 1.33% gc time, 99.98% compilation time)

@codecov
Copy link
Copy Markdown

codecov bot commented May 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (172fd12) to head (1675a69).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #252   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        16    +1     
  Lines         1833      1844   +11     
=========================================
+ Hits          1833      1844   +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gdalle gdalle marked this pull request as ready for review May 3, 2025 10:25
@gdalle gdalle marked this pull request as draft May 3, 2025 14:44
@gdalle gdalle marked this pull request as ready for review May 10, 2025 06:28
@gdalle gdalle requested a review from amontoison May 26, 2025 09:52
@amontoison amontoison merged commit f7acc3f into main May 26, 2025
6 checks passed
@amontoison amontoison deleted the gd/precompilation branch May 26, 2025 18:24
@gdalle gdalle mentioned this pull request Sep 10, 2025
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