Published: May 23 2011 / 01:39
14 down votes without reason???
It was probably voted down due to an inaccurate test (see comments on blog).
Its not an inaccurate test, buffered streams use the buffer internally. Hence I did not use the buffer in first program. If you take the source code from the JAVA IO package for Buffered Streams and just remove the synchronized keywords from the code. You will see the difference.
I may be wrong but someone needs to prove with appropriate test code.
Well I found an article whose benchmarks shows buffersteam have better performance http://www.precisejava.com/javaperf/j2se/IO.htm.
Btw I think default buffer size is 512 bytes
In the article you have mentioned there are 3 key points mentioned at the end, I have tried to prove the same in my article.
Reading and writing data using default behavior of some streams that is byte by byte read/write causes slow performance.
Buffered input streams and buffered output streams increase performance.
Custom buffering increases performance significantly.
yes, Tarun thats the point !!! One should look into the details first without blindly following the concept. Buffer streams are better than the default behavior but not when bytes are read directly. There is one more point regarding the custom buffering that it loads all the bytes in the memory so that might put load on the RAM.
Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.
Advertising - Terms of Service - Privacy - © 1997-2014, DZone, Inc.