perf: avoid negative environment lookup (#5429)
Avoids some `Environment.find?` lookup misses that become especially expensive on the async branch
This commit is contained in:
parent
cb40ddad69
commit
dac73c15c8
1 changed files with 3 additions and 1 deletions
|
|
@ -831,10 +831,12 @@ mutual
|
|||
else
|
||||
unfoldDefault ()
|
||||
| .const declName lvls => do
|
||||
let some cinfo ← getUnfoldableConstNoEx? declName | pure none
|
||||
-- check smart unfolding only after `getUnfoldableConstNoEx?` because smart unfoldings have a
|
||||
-- significant chance of not existing and `Environment.contains` misses are more costly
|
||||
if smartUnfolding.get (← getOptions) && (← getEnv).contains (mkSmartUnfoldingNameFor declName) then
|
||||
return none
|
||||
else
|
||||
let some cinfo ← getUnfoldableConstNoEx? declName | pure none
|
||||
unless cinfo.hasValue do return none
|
||||
deltaDefinition cinfo lvls
|
||||
(fun _ => pure none)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue