• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to calculate Buffered Input Output Time  RSS feed

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I am reading a file using BufferedInputStream according to java doc it is faster then other Input Stream.

But I want to know is there any way so that I can calculate Buffering time for Input and Output?


Thanks
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The javadoc doesn't say BufferedInputStream is faster, at least not the official one linked to in the post you just made. I mean it might be faster but that doesn't seem to be stated in the docs.

What in the javadocs made you think it is faster?
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes,you are true

I mean sometimes if we are reading data over a network then It is better to use BufferdInputStream as compare to other InputStream at that time.

This is what I mean by faster


 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should set up some fixed resource you can reference over and over again (a file or something in the target location). Then you record the current time (System.currentTimeMillis()) use a buffered input stream to the resource, read it fully, then record the time when done. Take the difference between start and stop.

Then do the same with a few of the other input streams.

Repeat multiple times, alternating between the BIS and other IS.

Average results and compare timing.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks steve

It works
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!