Repository navigation
Compile in the main isolate in the native standalone - #26
Draft
Ivo Horák (horakivo) wants to merge 1 commit into
Draft
Ivo Horák (horakivo) wants to merge 1 commit into
Ivo Horák (horakivo) wants to merge 1 commit into
Conversation
Truffle compilations of the native standalone run in a separate isolate by default. That isolate has its own heap, which starts with a young generation of about 48 MB that is touched before its first collection, and it maps and touches the image heap a second time. Compile in the main isolate instead; the compiler's allocations then share the main heap and its young generation. --vm.XX:+CompileInIsolates restores the separate isolate per process.
Merging this PR will regress 5 benchmarks1 warning
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft, do not merge. Opened to measure memory and speed on the benchmark host.
Why
A fresh
graalpyprocess that does nothing has a peak RSS of about 169 MB on the benchmark host. A breakdown of where that goes (mapping-level bytes on a macOS build, so the structure carries over and the absolute numbers do not) shows that much of it is fixed per process, and that a large part belongs to a second isolate:The change
Build
libpythonvmwith-R:-CompileInIsolates, so runtime compilation happens in the main isolate.--vm.XX:+CompileInIsolatesrestores the default.On the macOS build the peak RSS of the
memoryrows went from 207 to 174 MB (idle), 259 to 225 MB (after 12 standard-library imports) and 320 to 276 MB (one million short strings).Measured
One benchmark run of this branch against
developon the benchmark host (Linux x86-64).Peak RSS of a fresh process:
developAlmost every other benchmark's peak RSS also drops by 50 to 90 MB.
Median iteration time, geometric mean of the ratios (above 1 is slower): real packages 1.05, C API micro 1.01, pure Python 1.01, interpreter only 1.00, start-up 1.03, wall time of the memory rows 1.11.
pandas-groupby-merge0.83 s to 1.07 s,numpy-small-ops0.63 to 0.70 s up to 0.76 s,lxml-xpathandpandas-apply12%,c-instantiate-large0.92 s to 1.22 s,startup/stdlib-imports8%, the shortmemoryprocesses 4 to 18%.raytrace-simple,euler11,particlefilterslower;mandelbrot3,knucleotidefaster); with one run it is not clear which of these are the build-to-build variation these rows have shown before.Costs to look for in the run
🤖 Generated with Claude Code