lean4-htt/tests/bench/identifier_completion.lean
Marc Huisinga 0160aa1a89
test: identifier completion benchmark (#6796)
Adds a basic identifier completion benchmark so that bugs like the one
in #6794 are caught earlier.
2025-01-27 19:31:32 +00:00

26 lines
732 B
Text

prelude
import Lean.AddDecl
open Lean
set_option debug.skipKernelTC true
def buildSyntheticEnv : Lean.CoreM Unit := do
for i in [0:100000] do
let name := s!"Long.And.Hopefully.Unique.Name.foo{i}".toName
addDecl <| Declaration.opaqueDecl {
name := name
levelParams := []
type := .const `Nat []
value := .const `Nat.zero []
isUnsafe := false
all := [name]
}
addDocString name "A synthetic doc-string"
#eval buildSyntheticEnv
-- This will be quite a bit slower than the equivalent in a file that imports all of these decls,
-- since we can pre-compute information about those imports.
-- It still serves as a useful benchmark, though.
#eval Long.And.Hopefully.Unique.Name.foo