From b6bd5f581593785b2eae203e3784e047d95f8c07 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Tue, 13 Feb 2024 15:14:56 -0500 Subject: [PATCH] EnumX --> Symbol is slow --- src/default.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/default.jl b/src/default.jl index 48e8a9b1f..d3d06f1a0 100644 --- a/src/default.jl +++ b/src/default.jl @@ -218,6 +218,7 @@ function defaultalg(A, b, assump::OperatorAssumptions{Bool}) DefaultLinearSolver(alg) end +@inline algchoice_to_alg(::Val{alg}) where {alg} = algchoice_to_alg(alg) function algchoice_to_alg(alg::Symbol) if alg === :SVDFactorization SVDFactorization(false, LinearAlgebra.QRIteration()) @@ -345,11 +346,12 @@ end retcode = sol.retcode, iters = sol.iters, stats = sol.stats) end + alg_enum = getproperty(LinearSolve.DefaultAlgorithmChoice, alg) ex = if ex == :() - Expr(:elseif, :(Symbol(alg.alg) === $(Meta.quot(alg))), newex, + Expr(:elseif, :(alg.alg == $(alg_enum)), newex, :(error("Algorithm Choice not Allowed"))) else - Expr(:elseif, :(Symbol(alg.alg) === $(Meta.quot(alg))), newex, ex) + Expr(:elseif, :(alg.alg == $(alg_enum)), newex, ex) end end ex = Expr(:if, ex.args...)