diff --git a/eng/Versions.props b/eng/Versions.props
index f7611980e00..64a7ddd7135 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -95,6 +95,7 @@
4.3.0
4.3.0
4.5.0
+ 4.5.0
$(RoslynVersion)
$(RoslynVersion)
diff --git a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj
index f99d7aac7af..4ba9a9b2c32 100644
--- a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj
+++ b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj
@@ -680,6 +680,7 @@
+
diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj
index 8710d929be5..c919f3056b1 100644
--- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj
+++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj
@@ -743,6 +743,7 @@
+
diff --git a/src/utils/prim-parsing.fs b/src/utils/prim-parsing.fs
index b58e592278d..996cdc67d59 100644
--- a/src/utils/prim-parsing.fs
+++ b/src/utils/prim-parsing.fs
@@ -7,6 +7,7 @@ namespace Internal.Utilities.Text.Parsing
open Internal.Utilities.Text.Lexing
open System
+open System.Buffers
exception RecoverableParseError
exception Accept of obj
@@ -131,11 +132,7 @@ module internal Implementation =
//-------------------------------------------------------------------------
// Read the tables written by FSYACC.
- type AssocTable(elemTab:uint16[], offsetTab:uint16[]) =
- let cacheSize = 7919 // the 1000'th prime
- // Use a simpler hash table with faster lookup, but only one
- // hash bucket per key.
- let cache = Array.zeroCreate (cacheSize * 2)
+ type AssocTable(elemTab: uint16[], offsetTab: uint16[], cache: int[], cacheSize: int) =
member t.ReadAssoc (minElemNum,maxElemNum,defaultValueOfAssoc,keyToFind) =
// do a binary chop on the table
@@ -234,8 +231,21 @@ module internal Implementation =
let ruleValues = (Array.zeroCreate 100 : obj[])
let lhsPos = (Array.zeroCreate 2 : Position[])
let reductions = tables.reductions
- let actionTable = new AssocTable(tables.actionTableElements, tables.actionTableRowOffsets)
- let gotoTable = new AssocTable(tables.gotos, tables.sparseGotoTableRowOffsets)
+ let cacheSize = 7919 // the 1000'th prime
+ // Use a simpler hash table with faster lookup, but only one
+ // hash bucket per key.
+ let actionTableCache = ArrayPool.Shared.Rent(cacheSize * 2)
+ let gotoTableCache = ArrayPool.Shared.Rent(cacheSize * 2)
+ // Clear the arrays since ArrayPool does not
+ Array.Clear(actionTableCache, 0, actionTableCache.Length)
+ Array.Clear(gotoTableCache, 0, gotoTableCache.Length)
+ use _cacheDisposal =
+ { new IDisposable with
+ member _.Dispose() =
+ ArrayPool.Shared.Return actionTableCache
+ ArrayPool.Shared.Return gotoTableCache }
+ let actionTable = AssocTable(tables.actionTableElements, tables.actionTableRowOffsets, actionTableCache, cacheSize)
+ let gotoTable = AssocTable(tables.gotos, tables.sparseGotoTableRowOffsets, gotoTableCache, cacheSize)
let stateToProdIdxsTable = new IdxToIdxListTable(tables.stateToProdIdxsTableElements, tables.stateToProdIdxsTableRowOffsets)
let parseState =