提交 572ffe09 编写于 作者: R Rikki Gibson 提交者: Don Syme

[CompilerPerf] Performance improvement in ComputeUngeneralizeableTypars (#3065)

* Minor cleanup to TypeChecker signature - removed duplicated return value

* Changed a bunch of set unioning to use an array instead

* Used Add in a loop in ComputeUngeneralizableTypars, cut 5% of main0 runtime
上级 0bc02632
...@@ -2059,24 +2059,16 @@ type GeneralizeConstrainedTyparOptions = ...@@ -2059,24 +2059,16 @@ type GeneralizeConstrainedTyparOptions =
module GeneralizationHelpers = module GeneralizationHelpers =
let ComputeUngeneralizableTypars env = let ComputeUngeneralizableTypars env =
// This is just a List.fold. Unfolded here to enable better profiling let acc = Collections.Generic.List()
let rec loop acc (items: UngeneralizableItem list) = for item in env.eUngeneralizableItems do
match items with if not item.WillNeverHaveFreeTypars then
| [] -> acc let ftps = item.GetFreeTyvars().FreeTypars
| item::rest -> if not ftps.IsEmpty then
let acc = for ftp in ftps do
if item.WillNeverHaveFreeTypars then acc.Add(ftp)
acc
else Zset.Create(typarOrder, acc)
let ftps = item.GetFreeTyvars().FreeTypars
if ftps.IsEmpty then
acc
else
// These union operations are a performance sore point
unionFreeTypars ftps acc
loop acc rest
loop emptyFreeTypars env.eUngeneralizableItems
let ComputeUnabstractableTycons env = let ComputeUnabstractableTycons env =
let acc_in_free_item acc (item: UngeneralizableItem) = let acc_in_free_item acc (item: UngeneralizableItem) =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册