• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to calculate Buffered Input Output Time

 
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks steve

It works
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic