Skip to content

Conversation

jClugstor
Copy link
Member

@jClugstor jClugstor commented Aug 22, 2025

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

using LinearSolve, BenchmarkTools
using SciMLLogging: Verbosity
n = 4
A = rand(n, n)
b1 = rand(n);
b2 = rand(n);
prob = LinearProblem(A, b1)

With this PR:

@btime solve(prob, verbose=false)
365.015 ns (11 allocations: 928 bytes)

using SciMLLogging: Verbosity
@btime solve(prob, verbose = LinearVerbosity(Verbosity.None()))
363.893 ns (12 allocations: 960 bytes)

@btime solve(prob, verbose=true)
 432.445 ns (15 allocations: 1.03 KiB)

@report_opt solve(prob, verbose = LinearVerbosity(Verbosity.None()))
No errors detected

@report_opt solve(prob, verbose = false)
No errors detected

@profview for i in 1:10000000 init(prob, verbose = false) end 
NewPRProfile

From the profile we can see that the constructor for LinearVerbosity doesn't even get called from __init, which should indicate that it got compiled out.

With current main (Bool verbosity system)

`@btime solve(prob, verbose=false)`
 `359.857 ns (11 allocations: 928 bytes)`

`@btime solve(prob, verbose=true)`
` 329.573 ns (11 allocations: 928 bytes)`

@profview for i in 1:10000000 init(prob, verbose = false) end 
OldVerbosityProfile

@jClugstor
Copy link
Member Author

@ChrisRackauckas

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