jeantil commented on PR #2700: URL: https://github.com/apache/james-project/pull/2700#issuecomment-2794952792
I added a microbenchmark harness for `CRLFInputStream` that I committed along with the rest but disabled to prevent the bench from further slowing down the CI I also aligned the FIFO queue buffer size with the inpustream default buffer size used in transferTo to minimize unnecessary allocations in the common case. Here are the bench results I get on my computer ``` Benchmark Mode Cnt Score Error Units CRLFInputStreamBenchmark.measure_force_crlf_inputstream_wellformed avgt 5 410.651 ± 27.984 us/op CRLFInputStreamBenchmark.measure_force_crlf_inputstream_wellformed:gc.alloc.rate avgt 5 3342.409 ± 230.725 MB/sec CRLFInputStreamBenchmark.measure_force_crlf_inputstream_wellformed:gc.alloc.rate.norm avgt 5 1439000.726 ± 0.049 B/op CRLFInputStreamBenchmark.measure_force_crlf_inputstream_wellformed:gc.count avgt 5 273.000 counts CRLFInputStreamBenchmark.measure_force_crlf_inputstream_wellformed:gc.time avgt 5 185.000 ms CRLFInputStreamBenchmark.measure_force_crlf_outputstream_wellformed avgt 5 66.754 ± 2.271 us/op CRLFInputStreamBenchmark.measure_force_crlf_outputstream_wellformed:gc.alloc.rate avgt 5 2670.461 ± 90.060 MB/sec CRLFInputStreamBenchmark.measure_force_crlf_outputstream_wellformed:gc.alloc.rate.norm avgt 5 186928.118 ± 0.003 B/op CRLFInputStreamBenchmark.measure_force_crlf_outputstream_wellformed:gc.count avgt 5 218.000 counts CRLFInputStreamBenchmark.measure_force_crlf_outputstream_wellformed:gc.time avgt 5 160.000 ms CRLFInputStreamBenchmark.measure_wellformed avgt 5 6.159 ± 0.042 us/op CRLFInputStreamBenchmark.measure_wellformed:gc.alloc.rate avgt 5 17021.441 ± 115.950 MB/sec CRLFInputStreamBenchmark.measure_wellformed:gc.alloc.rate.norm avgt 5 109944.011 ± 0.001 B/op CRLFInputStreamBenchmark.measure_wellformed:gc.count avgt 5 1396.000 counts CRLFInputStreamBenchmark.measure_wellformed:gc.time avgt 5 967.000 ms ``` If I understand this correctly, the CRLF inputstream implementation is an order of magnitude slower than the current CRLFoutputstream which itself is an order of magnitude slower than no CRLF handling. I am really bad at manually managing buffers I always end up mixing offsets so I'm not confident i can achieve a faster implementation but I think it should be possible to do it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org