lean4-htt/tests/bench/identifier_completion.lean
Sebastian Ullrich 9757a7be53
perf: do not export opaque bodies (#10119)
In particular, do not export `partial` bodies
2025-08-27 20:59:59 +00:00

25 lines
784 B
Text

prelude
import Lean.AddDecl
open Lean
def buildSyntheticEnv : Lean.CoreM Unit := do
for i in [0:100000] do
let name := s!"Long.And.Hopefully.Unique.Name.foo{i}".toName
let env' ← ofExceptKernelException <| (← getEnv).addDeclCore (cancelTk? := none) 0 <| .opaqueDecl {
name := name
levelParams := []
type := .const `Nat []
value := .const `Nat.zero []
isUnsafe := false
all := [name]
}
setEnv env'
addDocStringCore 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