Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #28533
| From | Robert Klemme <shortcutter@googlemail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: NIO not so hot |
| Date | 2014-05-18 19:09 +0200 |
| Message-ID | <bts7pqFne9dU1@mid.individual.net> (permalink) |
| References | <t24en9putph3mbnulkveghdjbrnisp105h@4ax.com> <btrkdnFjc3qU1@mid.individual.net> <btrkeiFjc3qU2@mid.individual.net> <btrme9Fjp4lU1@mid.individual.net> |
On 18.05.2014 14:12, Robert Klemme wrote:
> On 18.05.2014 13:38, Robert Klemme wrote:
>> On 18.05.2014 13:38, Robert Klemme wrote:
>>
>>> https://gist.github.com/rklemme/fad399b5e7cc4d3b6d0c
>>
>> PS: I just notice some oddity with the ASCII file size which is too
>> small. I need to check that.
>
> Error was duplicate counting chars during creation. This is fixed now.
I rearranged execution order a bit to group all read operations on one
file and all NIO reads with direct or heap buffer.
https://gist.github.com/rklemme/fad399b5e7cc4d3b6d0c#file-output-txt
My takeaways:
- IO and NIO have roughly same performance for char decoding
if done properly.
- Adding byte buffering to IO does not help, rather it makes
things slower.
- Reading into char[] with IO is more efficient than using
char buffering.
- NIO direct buffers are slower than heap buffers; they are
probably best used if the data does not need to reach
the Java heap (e.g. when copying a file to another file
or a socket).
- Best performance with NIO is with a multiple of memory page
size (or file system cluster size?).
- decoding of pure ASCII in UTF-8 is much more efficient
than random UTF-8 data (over 4 times faster per byte than
the mixed UTF-8 file).
ASCII 0,001525879 us/byte and char
UTF 0,006485037 us/byte
UTF 0,019073486 us/char
Cheers
robert
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
NIO not so hot Roedy Green <see_website@mindprod.com.invalid> - 2014-05-17 04:28 -0700
Re: NIO not so hot Robert Klemme <shortcutter@googlemail.com> - 2014-05-18 13:38 +0200
Re: NIO not so hot Robert Klemme <shortcutter@googlemail.com> - 2014-05-18 13:38 +0200
Re: NIO not so hot Robert Klemme <shortcutter@googlemail.com> - 2014-05-18 14:12 +0200
Re: NIO not so hot Robert Klemme <shortcutter@googlemail.com> - 2014-05-18 19:09 +0200
Re: NIO not so hot Roedy Green <see_website@mindprod.com.invalid> - 2014-05-26 00:51 -0700
Re: NIO not so hot Robert Klemme <shortcutter@googlemail.com> - 2014-05-26 20:14 +0200
Re: NIO not so hot Roedy Green <see_website@mindprod.com.invalid> - 2014-05-26 01:15 -0700
Re: NIO not so hot Roedy Green <see_website@mindprod.com.invalid> - 2014-05-26 01:24 -0700
Re: NIO not so hot Robert Klemme <shortcutter@googlemail.com> - 2014-05-26 23:50 +0200
Re: NIO not so hot Rupert Smith <rupertlssmith@googlemail.com> - 2014-05-31 02:29 -0700
Re: NIO not so hot Robert Klemme <shortcutter@googlemail.com> - 2014-06-01 12:15 +0200
Re: NIO not so hot Rupert Smith <rupertlssmith@googlemail.com> - 2014-06-02 07:37 -0700
Re: NIO not so hot Robert Klemme <shortcutter@googlemail.com> - 2014-06-03 23:07 +0200
Re: NIO not so hot Rupert Smith <rupertlssmith@googlemail.com> - 2014-06-06 01:32 -0700
Re: NIO not so hot Rupert Smith <rupertlssmith@googlemail.com> - 2014-06-02 07:46 -0700
csiph-web