Hacker News new | ask | show | jobs
by lzaf 237 days ago
On a similar vein some time ago I had written a small toy lib that emulates the os.File interface for nmap backed files: https://github.com/zaf/yammap, It even handled bus errors without panicking: https://github.com/zaf/yammap/blob/186f714343906bb9304ad5f30...

Read and write performance was usually better especially with larger write sizes. Compared to os.File:

  ~/src/yammap$ go test -benchtime=4s -bench .
  goos: linux
  goarch: amd64
  pkg: github.com/zaf/yammap
  cpu: AMD Ryzen 9 5900X 12-Core Processor
  BenchmarkWrite-24          29085     164744 ns/op 25459.52 MB/s
  BenchmarkOSWrite-24        22204     215131 ns/op 19496.54 MB/s
  BenchmarkRead-24           29113     166820 ns/op 25142.72 MB/s
  BenchmarkOSRead-24         27451     172685 ns/op 24288.69 MB/s