lean4-htt/tests/bench/workspaceSymbols.lean
Joachim Breitner d8a67095d6
chore: make workspaceSymbol benchmarks modules (#11094)
This PR makes workspaceSymbol benchmarks `module`s, so that they are
less sensitive to additions of private symbols in the standard library.
2025-11-05 18:40:39 +00:00

18 lines
465 B
Text

module
import Lean
meta import Lean.Data.FuzzyMatching
open Lean Elab
def bench (pattern : String) : TermElabM Unit := do
let env ← getEnv
let mut n := 0
-- IO.println s!"{env.constants.size} decls"
for (c, _) in env.constants.toList do
if Lean.FuzzyMatching.fuzzyMatch pattern c.toString then n := n + 1
IO.println s!"{n} matches"
set_option profiler true
#eval bench "L"
#eval bench "Lean."
#eval bench "Lean.Expr"
#eval bench "Lean.Expr.const"