Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #28435

Re: byte stream vs char stream buffer

From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: byte stream vs char stream buffer
Date 2014-05-11 16:02 +0200
Message-ID <bt9e82Fll8eU1@mid.individual.net> (permalink)
References (1 earlier) <slrnlmn1n7.bi9.avl@login.logic.tuwien.ac.at> <mr0qm9hbbeqj0rggqco3umj91bqvjeti58@4ax.com> <en0tm9pu331ts50galimgbk8bkseu83mtk@4ax.com> <bt7jpaFa8d5U1@mid.individual.net> <pqbtm9h82nb1q0qbdf87bae2h1jeot5uno@4ax.com>

Show all headers | View raw


On 11.05.2014 01:08, Roedy Green wrote:
> On Sat, 10 May 2014 23:24:57 +0200, Robert Klemme
> <shortcutter@googlemail.com> wrote, quoted or indirectly quoted
> someone who said :
>
>> I find this a fairly unspecific description of the test you did.  We do
>> not know what your test did to ensure file system caching or GC effects
>> did not influence the measurement etc.
>
> the code is posted at
> http://mindprod.com/applet/fileio.html#BUFFERSIZE

I followed a slightly different approach and modularized my test a bit 
more.  You can find it here:

https://gist.github.com/rklemme/fad399b5e7cc4d3b6d0c

File opening and closing is not measured.  You can assume the data to 
purely come from memory (vastly more mem than file size + no disk 
activity shown).  This was on an Xbuntu 14.04 64 bit, kernel version 
3.13.0-24.  No special JVM command line switches were used.

> These are not particularly subtle effects.  I ran five trials and took
> the best time for each. I figured this would eliminate hotspot
> initialisation and GC effects.

Sounds good.  I followed the same approach (i.e. repeating and using the 
min time value).

My results:

  - The higher level the buffering, the more effective.
  - Buffering on byte level often actually rather hurts than helps.
  - Reading in 1k chunks from the application level is already close to 
optimal.

Kind regards

	robert

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

byte stream vs char stream buffer Roedy Green <see_website@mindprod.com.invalid> - 2014-05-06 23:48 -0700
  Re: byte stream vs char stream buffer Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-05-08 13:30 +0000
    Re: byte stream vs char stream buffer Roedy Green <see_website@mindprod.com.invalid> - 2014-05-09 09:34 -0700
      Re: byte stream vs char stream buffer Roedy Green <see_website@mindprod.com.invalid> - 2014-05-10 13:18 -0700
        Re: byte stream vs char stream buffer Robert Klemme <shortcutter@googlemail.com> - 2014-05-10 23:24 +0200
          Re: byte stream vs char stream buffer Roedy Green <see_website@mindprod.com.invalid> - 2014-05-10 16:08 -0700
            Re: byte stream vs char stream buffer Robert Klemme <shortcutter@googlemail.com> - 2014-05-11 16:02 +0200
              Re: byte stream vs char stream buffer markspace <markspace@nospam.nospam> - 2014-05-11 11:50 -0700
                Re: byte stream vs char stream buffer markspace <markspace@nospam.nospam> - 2014-05-11 12:10 -0700
                Re: byte stream vs char stream buffer Robert Klemme <shortcutter@googlemail.com> - 2014-05-11 21:34 +0200
                Re: byte stream vs char stream buffer markspace <markspace@nospam.nospam> - 2014-05-11 12:55 -0700
                Re: byte stream vs char stream buffer Roedy Green <see_website@mindprod.com.invalid> - 2014-05-16 16:55 -0700
                Re: byte stream vs char stream buffer markspace <markspace@nospam.nospam> - 2014-05-16 17:36 -0700
                Re: byte stream vs char stream buffer Roedy Green <see_website@mindprod.com.invalid> - 2014-05-16 19:52 -0700
              Re: byte stream vs char stream buffer Roedy Green <see_website@mindprod.com.invalid> - 2014-05-16 16:37 -0700
          Re: byte stream vs char stream buffer Roedy Green <see_website@mindprod.com.invalid> - 2014-05-10 17:21 -0700
            Re: byte stream vs char stream buffer Martin Gregorie <martin@address-in-sig.invalid> - 2014-05-11 09:05 +0000
              Re: byte stream vs char stream buffer Roedy Green <see_website@mindprod.com.invalid> - 2014-05-12 02:07 -0700
                Re: byte stream vs char stream buffer Silvio <silvio@internet.com> - 2014-05-12 12:20 +0200
                Re: byte stream vs char stream buffer Roedy Green <see_website@mindprod.com.invalid> - 2014-05-16 20:19 -0700
                Re: byte stream vs char stream buffer Roedy Green <see_website@mindprod.com.invalid> - 2014-05-18 05:28 -0700
                Re: byte stream vs char stream buffer Silvio <silvio@internet.com> - 2014-05-18 23:54 +0200

csiph-web