@@ -151,7 +151,10 @@ module internal Implementation =
151
151
//-------------------------------------------------------------------------
152
152
// Read the tables written by FSYACC.
153
153
154
- type AssocTable ( elemTab : uint16 [], offsetTab : uint16 [], cache : int [], cacheSize : int ) =
154
+ type AssocTable ( elemTab : uint16 [], offsetTab : uint16 [], cache : int []) =
155
+
156
+ do Array.fill cache 0 cache.Length - 1
157
+ let cacheSize = cache.Length / 2
155
158
156
159
member t.ReadAssoc ( minElemNum , maxElemNum , defaultValueOfAssoc , keyToFind ) =
157
160
// do a binary chop on the table
@@ -273,13 +276,8 @@ module internal Implementation =
273
276
let lhsPos = ( Array.zeroCreate 2 : Position[])
274
277
let reductions = tables.reductions
275
278
let cacheSize = 7919 // the 1000'th prime
276
- // Use a simpler hash table with faster lookup, but only one
277
- // hash bucket per key.
278
279
let actionTableCache = ArrayPool< int>. Shared.Rent( cacheSize * 2 )
279
280
let gotoTableCache = ArrayPool< int>. Shared.Rent( cacheSize * 2 )
280
- // Clear the arrays since ArrayPool does not
281
- Array.Clear( actionTableCache, 0 , actionTableCache.Length)
282
- Array.Clear( gotoTableCache, 0 , gotoTableCache.Length)
283
281
284
282
use _cacheDisposal =
285
283
{ new IDisposable with
@@ -289,10 +287,10 @@ module internal Implementation =
289
287
}
290
288
291
289
let actionTable =
292
- AssocTable( tables.actionTableElements, tables.actionTableRowOffsets, actionTableCache, cacheSize )
290
+ AssocTable( tables.actionTableElements, tables.actionTableRowOffsets, actionTableCache)
293
291
294
292
let gotoTable =
295
- AssocTable( tables.gotos, tables.sparseGotoTableRowOffsets, gotoTableCache, cacheSize )
293
+ AssocTable( tables.gotos, tables.sparseGotoTableRowOffsets, gotoTableCache)
296
294
297
295
let stateToProdIdxsTable =
298
296
IdxToIdxListTable( tables.stateToProdIdxsTableElements, tables.stateToProdIdxsTableRowOffsets)
0 commit comments