4 ms·
Sure. The problem is that intermediate-skill developers read comments like yours and just glean "lol, syscalls are slow" from them. They then go on to use mmap
by rewqfdsa 11y ago
Sure. The problem is that intermediate-skill developers read comments like yours and just glean "lol, syscalls are slow" from them. They then go on to use mmap and kill MM performance. It's important to keep your audience in mind. Most developers do not write high-performance IO layers that talk directly to hardware. Most developers will blindly follow any sufficiently authoritative voice that tells them X is better than Y, which leads them to misuse powerful tools.
In the vast majority of cases, you want plain read and write. In the vast majority of cases, the overhead of jumping into the kernel is not your bottleneck. Simplicity counts for a lot.
- hyc_symas 11y agoYes, simplicity counts for a lot. Staying in user space is simpler. The reason LMDB can pack so much functionality into only 7KLOCs is because using mmap is much simpler than using read() and maintaining a user-level buffer cache. In the vast majority of cases, developers need to profile their code if they actually care about performance - and fail to do so.