Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Lazily initialize framework maps
They are not needed on a simple restore but take time
  • Loading branch information
vbfox committed Feb 27, 2018
commit 99c66030e8396d519bbcd350b91e7df39d9a81e9
18 changes: 13 additions & 5 deletions src/Paket.Core/Versioning/FrameworkHandling.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1321,22 +1321,30 @@ module SupportCalculation =
|> List.map (fun p -> p, getSupportedPortables p)
|> ofSeq

let mutable private supportMap = optimizeSupportMap (createInitialSupportMap())
let mutable private supportMap: SupportMap option = None

let private getSupportMap () =
match supportMap with
| Some supportMap ->
supportMap
| None ->
supportMap <- Some (optimizeSupportMap (createInitialSupportMap()))
supportMap.Value

let getSupportedPreCalculated (p:PortableProfileType) =
match supportMap.TryGetValue p with
match getSupportMap().TryGetValue p with
| true, v -> v
| _ ->
match p with
| UnsupportedProfile tfs ->
match supportMap.TryGetValue p with
match getSupportMap().TryGetValue p with
| true, v -> v
| _ ->
let clone = supportMap |> toSeq |> ofSeq
let clone = getSupportMap() |> toSeq |> ofSeq
clone.[p] <- getSupportedPortables p
let opt = optimizeSupportMap clone
let result = opt.[p]
supportMap <- opt
supportMap <- Some opt
result
| _ -> failwithf "Expected that default profiles are already created."

Expand Down