rust-mmap
rust-mmap copied to clipboard
Add MapOption::MapShared
I am not an expert on libc
, so can't tell if this is a standard option, but it makes a massive difference on Mac.
Reproducer: https://stackoverflow.com/questions/58366166/performance-analysis (Go program is provided there only as a baseline of what the OS is actually able to achieve)
Solution: add MapOption::MapNonStandardFlags(libc::MAP_SHARED),
to the list of MapOption
s. Then the times are within a reasonable range. (about 3 seconds on "warm" run instead of 30+)
Given the comments to that question, it seems to make no difference on Linux - ie it is already quite fast even without this flag, but it appears to have a big impact on Mac OS.
It appears there's even a Pull request ready: https://github.com/rbranson/rust-mmap/pull/8