Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/11.0.100.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
* Add symbol and type highlighting to F# diagnostics ([PR #20097](https://github.com/dotnet/fsharp/pull/20097))
* IL: add `ILPreNamespace`, make `ILPreTypeDef` creation lazy ([PR #20092](https://github.com/dotnet/fsharp/pull/20092))
* IL: use empty tables for members when possible ([PR #20249](https://github.com/dotnet/fsharp/pull/20249))
* IL: size the string heap cache to grow and remove the type name intern table

### Improved

Expand Down
11 changes: 5 additions & 6 deletions src/Compiler/AbstractIL/ilread.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,6 @@ type ILMetadataReader =
blobsStreamPhysicalLoc: int32
blobsStreamSize: int32
readUserStringHeap: int32 -> string
memoizeString: string -> string
readStringHeap: int32 -> string
readBlobHeap: int32 -> byte[]
guidsStreamPhysicalLoc: int32
Expand Down Expand Up @@ -2081,7 +2080,7 @@ and readBlobHeapAsTypeName ctxt (nameIdx, namespaceIdx) =

match nspace with
| None -> name
| Some ns -> ctxt.memoizeString (ns + "." + name)
| Some ns -> ns + "." + name

and seekReadTypeDefRowExtents (ctxt: ILMetadataReader) _info (idx: int) =
if idx >= ctxt.getNumRows TableNames.TypeDef then
Expand Down Expand Up @@ -4246,7 +4245,7 @@ let openMetadataReader
let firstStreamLength = seekReadInt32 mdv (streamHeadersStart + 4)
firstStreamOffset, firstStreamLength

let stringsStreamPhysicalLoc, stringsStreamSize =
let stringsStreamPhysicalLoc, _stringsStreamSize =
findStream [| 0x23; 0x53; 0x74; 0x72; 0x69; 0x6e; 0x67; 0x73 |] (* #Strings *)

let userStringsStreamPhysicalLoc, userStringsStreamSize =
Expand Down Expand Up @@ -4520,8 +4519,9 @@ let openMetadataReader
let cacheUserStringHeap =
mkCacheGeneric reduceMemoryUsage inbase "UserStringHeap" (userStringsStreamSize / 20 + 1)
// nb. Lots and lots of cache hits on this cache, hence never optimize cache away
let cacheStringHeap =
mkCacheGeneric false inbase "string heap" (stringsStreamSize / 50 + 1)
// Sized to grow rather than from the stream length: only a small fraction of a #Strings heap is ever
// read, so sizing from it left the table around 11% full, one nearly-empty table per reference.
let cacheStringHeap = mkCacheGeneric false inbase "string heap" 0

let cacheBlobHeap =
mkCacheGeneric reduceMemoryUsage inbase "blob heap" (blobsStreamSize / 50 + 1)
Expand Down Expand Up @@ -4565,7 +4565,6 @@ let openMetadataReader
stringsStreamPhysicalLoc = stringsStreamPhysicalLoc
blobsStreamPhysicalLoc = blobsStreamPhysicalLoc
blobsStreamSize = blobsStreamSize
memoizeString = Tables.memoize id
readUserStringHeap = cacheUserStringHeap (readUserStringHeapUncached ctxtH)
readStringHeap = cacheStringHeap (readStringHeapUncached ctxtH)
readBlobHeap = cacheBlobHeap (readBlobHeapUncached ctxtH)
Expand Down
Loading