Link Details

Link 604611 thumbnail
User 468111 avatar

By tarun-dzone
via munchingjava.blogspot.com
Published: May 23 2011 / 01:39

This blog explains the performance issue with Java IO Buffered Streams
  • 9
  • 18
  • 3290
  • 9

Comments

Add your comment
User 211643 avatar

zynasis replied ago:

0 votes Vote down Vote up Reply

14 down votes without reason???

User 273999 avatar

matthewdfleming replied ago:

0 votes Vote down Vote up Reply

It was probably voted down due to an inaccurate test (see comments on blog).

User 468111 avatar

tarun-dzone replied ago:

0 votes Vote down Vote up Reply

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.

User 416683 avatar

Kapil Jain replied ago:

0 votes Vote down Vote up Reply

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

User 468111 avatar

tarun-dzone replied ago:

0 votes Vote down Vote up Reply

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.

User 416683 avatar

Kapil Jain replied ago:

1 votes Vote down Vote up Reply

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.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Java EE7
Written by: Andrew Lee Rubinger
Featured Refcardz: Top Refcardz:
  1. Design Patterns
  2. OO JS
  3. Cont. Delivery
  4. CI Patterns
  5. CI Tools
  1. Spring Integration
  2. Git
  3. Regex
  4. Java
  5. REST