Repository navigation
Improve memory mapping performance on POSIX [GH #648] - #649
wchilders-nvidia wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
AcknowlEDG review results updated for
CI success. |
daveedvdv-nvidia
left a comment
There was a problem hiding this comment.
Looks right to me: The temporary file never contributed anything but its size (the mappings are MAP_PRIVATE, so the pages written never go back to it), and nothing reads it back: When a PCH is created, write_memory_used_for_memory_regions writes the mapped memory itself, and when one is used, the PCH file is mapped rather than the temporary file. close_memory_region_tmp_file already handles a NULL handle.
I checked this with release builds of this PR and of its base, creating a PCH from a generated header with 2000 classes and using it. (Using it required disabling ASLR, with and without this change; otherwise there is a memory usage conflict.) The generated C is the same with and without this change, both when creating and when using the PCH. Creating a 138 MB PCH went from 0.63–0.67 s to 0.53–0.58 s.
A few small things are inline. The one I'd most like to see fixed is the scope of the Changes entry: USE_MMAP_FOR_MEMORY_REGIONS makes the mapping code available, but it is only used when precompiled_header_processing_required is set, i.e., with --create_pch, --use_pch, or --pch. Otherwise, alloc_mem_block gets its blocks from malloc, and map_memory_region_file is never called. So this only speeds up compilations that create or use a PCH.
34d68c5 to
70bde59
Compare
Use anonymous memory-mappings on Linux and BSD to avoid temporary backing-file creation overhead during incremental growth of the heap.
70bde59 to
b769339
Compare
daveedvdv-nvidia
left a comment
There was a problem hiding this comment.
Thanks — it all looks good now.
|
AcknowlEDG review results updated for
CI success. |
Use anonymous memory-mappings on Linux and BSD to avoid temporary backing-file creation overhead during incremental growth of the heap.
Summary by CodeRabbit