dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.15k stars 4.71k forks source link

SuperPMI: use an arena allocator for MethodContext #77878

Open BruceForstall opened 1 year ago

BruceForstall commented 1 year ago

When doing a superpmi replay using a Checked build, superpmi takes about 10% of replay time. The highest times are:

It looks like there could be throughput wins if we implemented an arena allocator that was more efficient with allocations (e.g., allocate large blocks from the OS, and reuse them) and more efficient with deallocation (simply free/reuse the entire arena; we never need to do partial deletes). Maybe steal/modify the JIT ArenaAllocator?

category:eng-sys theme:super-pmi skill-level:intermediate cost:medium impact:meduim

ghost commented 1 year ago

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch See info in area-owners.md if you want to be subscribed.

Issue Details
When doing a superpmi replay using a Checked build, superpmi takes about 10% of replay time. The highest times are: - `MethodContext::MethodInitHelper`. This 'new's the LightWeightMap structure and also reads data into each map - `free` - `MethodContext::Destroy`. This just runs `delete` on the maps - `RtlFreeHeap`. called from superpmi operator delete It looks like there could be throughput wins if we implemented an arena allocator that was more efficient with allocations (e.g., allocate large blocks from the OS, and reuse them) and more efficient with deallocation (simply free/reuse the entire arena; we never need to do partial deletes). Maybe steal/modify the JIT ArenaAllocator? category:eng-sys theme:super-pmi skill-level:intermediate cost:medium impact:meduim
Author: BruceForstall
Assignees: -
Labels: `area-CodeGen-coreclr`
Milestone: Future