Skip to content

Conversation

majocha
Copy link
Contributor

@majocha majocha commented Sep 25, 2025

Description

MemoizationTables use ConcurrentDictionary as a backing store. If we use named Cache instances with no eviction instead, we can collect and see their metrics with --times option:

    ----------------------------------------------------------------------------------------------------------------------------
    | Cache name                          | hit-ratio |     adds |  updates |     hits |   misses | evictions | eviction-fails |
    |-------------------------------------|-----------|----------|----------|----------|----------|-----------|----------------|
    | mostSpecificOverrideMethodInfoCache |    73.26% |      365 |        0 |     1000 |      365 |         0 |              0 |
    |                typeSubsumptionCache |    69.27% |   129308 |        0 |   291450 |   129308 |         0 |              0 |
    |           rawDataValueTypeGenerator |    96.40% |       39 |        0 |     1045 |       39 |         0 |              0 |
    |           primaryTypeHierarchyCache |    50.00% |       14 |        0 |       14 |       14 |         0 |              0 |
    |             implicitConversionCache |    92.71% |     1367 |        0 |    17385 |     1367 |         0 |              0 |
    |                     namedItemsCache |    56.65% |    15841 |        0 |    20697 |    15841 |         0 |              0 |
    |                      v_memoize_file |    99.90% |      380 |        0 |   385340 |      380 |         0 |              0 |
    |                   propertyInfoCache |    38.71% |     1762 |        0 |     1113 |     1762 |         0 |              0 |
    |                     methodInfoCache |    76.99% |     5621 |        0 |    18809 |     5621 |         0 |              0 |
    |                    ilFieldInfoCache |    75.19% |       32 |        0 |       97 |       32 |         0 |              0 |
    |            entireTypeHierarchyCache |    90.04% |     3428 |        0 |    30992 |     3428 |         0 |              0 |
    |           recdOrClassFieldInfoCache |    46.21% |      795 |        0 |      683 |      795 |         0 |              0 |
    |                      eventInfoCache |     0.00% |        1 |        0 |        0 |        1 |         0 |              0 |
    ----------------------------------------------------------------------------------------------------------------------------

In cases where there are many instances with the same name, the above data is accumulated by name.

possible TODOs: Identify other uses of ConcurrentDictionary that may be also instrumented like this. Maybe collect some more useful data, currently hit ratio is computed, the rest are just raw event counts as they come from the Cache.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 25, 2025

⚠️ Release notes required, but author opted out

Warning

Author opted out of release notes, check is disabled for this pull request.
cc @dotnet/fsharp-team-msft

@github-project-automation github-project-automation bot moved this from New to In Progress in F# Compiler and Tooling Sep 26, 2025
@T-Gro T-Gro added the NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes label Sep 26, 2025
@T-Gro T-Gro merged commit c193b34 into dotnet:main Sep 26, 2025
38 of 39 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in F# Compiler and Tooling Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants