hi there,
I know about bufio.Reader that provides a buffered version of an io.Reader.
Has anybody written a buffered version of an io.ReaderAt ?
I have this binary file format that implicitly forces decoders of said format to fetch data using ReadAt.
In C/C++, that's OK because files are open already buffered.
But when I compare the performances of my pure-Go based decoder with the C++ one, I see:
=== ROOT ===
real=4.27 user=3.63 sys=0.30 CPU=92% MaxRSS=305920 I/O=13656/0
real=4.33 user=3.95 sys=0.30 CPU=98% MaxRSS=306248 I/O=72/0
real=3.99 user=3.72 sys=0.27 CPU=100% MaxRSS=309516 I/O=0/0
real=3.92 user=3.65 sys=0.27 CPU=100% MaxRSS=306340 I/O=0/0
=== go-hep/rootio ===
real=8.37 user=8.11 sys=0.26 CPU=100% MaxRSS=40980 I/O=0/0
real=8.28 user=8.03 sys=0.26 CPU=100% MaxRSS=41004 I/O=0/0
real=8.41 user=8.16 sys=0.25 CPU=100% MaxRSS=40972 I/O=0/0
real=8.37 user=8.12 sys=0.26 CPU=100% MaxRSS=40976 I/O=0/0
and in the profile I see (*os.File).ReadAt (and then the according syscall)
so I'd need:
- either a way to open *os.File in buffered mode
- or tack a buffered io.Reader+io.ReaderAt
cheers,
-s