Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/borislavv/go-mmap
Comfortable implementation of mmap api in golang.
https://github.com/borislavv/go-mmap
efficiency golang mmap reading-files syscall
Last synced: 24 days ago
JSON representation
Comfortable implementation of mmap api in golang.
- Host: GitHub
- URL: https://github.com/borislavv/go-mmap
- Owner: Borislavv
- License: unlicense
- Created: 2024-06-23T15:26:43.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-06-25T09:49:49.000Z (6 months ago)
- Last Synced: 2024-10-21T22:09:30.505Z (2 months ago)
- Topics: efficiency, golang, mmap, reading-files, syscall
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Reading via Mmap obviously uses syscall.Mmap to improve the efficiency of multi-threaded reading of a file in chunks.
## Mmap
## Pread
# How is it fast:
- ./main 0,01s user 0,01s system 96% cpu 0,012 total
- ./main 0,01s user 0,01s system 99% cpu 0,016 total
- ./main 0,01s user 0,01s system 98% cpu 0,021 totalApproximately it's working for 0,017ms.
# P.S.
But this method is ineffective if you have heavy work on the received data (that is, if you use data either from the end or from the beginning of the slice). This is due to the way the file is mapped into memory, thus making the processor cache less efficient.
In that case, I would recommend considering using syscall.Pread with offsets.