3 ms·
The code seems clean. I'm not sure this is a great idea in practice, though. Generally the only good reason for mapping stuff out of the filesystem is perform
by ajross 8y ago
The code seems clean. I'm not sure this is a great idea in practice, though. Generally the only good reason for mapping stuff out of the filesystem is performance, and VM behavior with mmap() varies wildly across systems (and filesystem backends, and drivers if it's a hardware device, and hardware if it's a framebuffer, and...). Frankly on windows this is AFAIK a mostly-unheard-of technique. No one does mapping.
This just isn't really something that can be cleanly abstracted to do what you want it to do, even if you can make the code "look" the same.
But again, it looks like a nice, clean, modern C++ library. Just IMHO misapplied.
- frutiger 8y ago> Frankly on windows this is AFAIK a mostly-unheard-of technique. No one does mapping. Just a data point, but we use memory mapping (both with and without names) in our product that runs on Windows.
- buckminster 8y ago> Frankly on windows this is AFAIK a mostly-unheard-of technique. No one does mapping. It's not that uncommon. Even notepad uses it: https://blogs.msdn.microsoft.com/oldnewthing/20180521-00/?p=98795 https://blogs.msdn.microsoft.com/oldnewthing/20180521-00/?p=...
- vardump 8y ago> Frankly on windows this is AFAIK a mostly-unheard-of technique. No one does mapping. Really? Most larger (Windows) codebases I know of use memory mapping.
- xtrapolate 8y ago> "Frankly on windows this is AFAIK a mostly-unheard-of technique. No one does mapping." Unheared by you. In a world consumed by Electron apps and Javascript, lots of people couldn't care any less about performant IPC, sharing data across processes, and multiprocessing in general.
- bsenftner 8y agoMMapping is used in most fault tolerant software as a simplified method of data persistence. Granted, not the only method in play, but it is a common data safety net.
- ajross 8y agoFlushing behavior is precisely the kind of thing that varies the most between systems. I'd be very suspicious of a "fault tolerant" system that tried to use a library like this to be "cross platform". That's almost a contradiction in terms.
- bsenftner 8y agoWas not talking about that library, just memory mapped files.
- chris_wot 8y agoLibreOffice does quite a bit of memory mapping. So does everything else.
- hyperman1 8y ago> Frankly on windows this is AFAIK a mostly-unheard-of technique. No one does mapping. This must be incorrect. Jeffrey Richter's advanced windows, a very widespread win32 book, introduced this technique to a LOT of developers, just when windows was the hot stuff for programmers. I don't think I've seen a win32 code base >100 Kloc without mapping. Understanding and using it is one of those rites of passage that marks the switch from junior to medior win32 developer.