rust-mmap icon indicating copy to clipboard operation
rust-mmap copied to clipboard

Add MapOption::MapShared

Open olotenko opened this issue 5 years ago • 1 comments

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 MapOptions. 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.

olotenko avatar Oct 14 '19 09:10 olotenko

It appears there's even a Pull request ready: https://github.com/rbranson/rust-mmap/pull/8

olotenko avatar Oct 14 '19 09:10 olotenko