Skip to content

Instantly share code, notes, and snippets.

@ktoso
Created February 8, 2015 16:50
Show Gist options
  • Select an option

  • Save ktoso/47022f4bd89d3f104aff to your computer and use it in GitHub Desktop.

Select an option

Save ktoso/47022f4bd89d3f104aff to your computer and use it in GitHub Desktop.
// manual array based “chunk” signalling, with blocking IO
[info] a.s.StreamFileBenchmark.getLines 1048576 avgt 20 6.324 0.940 ms/op << GOAL (buf 8k)
[info] a.s.StreamFileBenchmark.source_getLines 1048576 avgt 20 174.420 25.517 ms/op // “people do this” workaround, horrible
[info] a.s.StreamFileBenchmark.source_blockingIo_chunk_1024_ahead_8 1048576 avgt 20 7.608 1.597 ms/op // eq buff (8k)
[info] a.s.StreamFileBenchmark.source_blockingIo_chunk_512_ahead_16 1048576 avgt 20 5.980 0.470 ms/op // eq buff (8k), readAhead is better!
[info] a.s.StreamFileBenchmark.source_blockingIo_chunk_256_ahead_4 1048576 avgt 20 13.358 2.463 ms/op // other buff sizes, less optimal
[info] a.s.StreamFileBenchmark.source_blockingIo_chunk_256_ahead_8 1048576 avgt 20 12.497 1.710 ms/op
[info] a.s.StreamFileBenchmark.source_blockingIo_chunk_512_ahead_4 1048576 avgt 20 7.131 1.127 ms/op
[info] a.s.StreamFileBenchmark.source_blockingIo_chunk_512_ahead_8 1048576 avgt 20 6.933 0.857 ms/op
// reusing byte buffers (heap)
[info] Benchmark (fileSize) Mode Samples Mean Mean error Units
[info] a.s.StreamFileBenchmark.getLines 1048576 avgt 20 6.930 0.104 ms/op << GOAL (buf 8k)
[info] a.s.StreamFileBenchmark.source_getLines 1048576 avgt 20 258.515 21.997 ms/op // “people do this”
[info] a.s.StreamFileBenchmark.source_blockingIo_chunk_1024_ahead_8 1048576 avgt 20 7.956 0.166 ms/op
[info] a.s.StreamFileBenchmark.source_blockingIo_chunk_512_ahead_16 1048576 avgt 20 8.120 0.343 ms/op it’s slower than just an array hm.
[info] a.s.StreamFileBenchmark.source_blockingIo_chunk_256_ahead_4 1048576 avgt 20 15.233 0.535 ms/op
[info] a.s.StreamFileBenchmark.source_blockingIo_chunk_256_ahead_8 1048576 avgt 20 15.518 0.675 ms/op
[info] a.s.StreamFileBenchmark.source_blockingIo_chunk_512_ahead_4 1048576 avgt 20 8.346 0.712 ms/op
[info] a.s.StreamFileBenchmark.source_blockingIo_chunk_512_ahead_8 1048576 avgt 20 8.136 0.533 ms/op
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment