-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>
> Note I am after the FASTEST way to do this in Java (and/or Scala).
>  Is it better to use the stream based classes, or is it better to
> do direct array accesses and do bit shift operations and masks
> with 0xff etc (to strip sign extension Java will do otherwise)?  I
> suspect the stream based approaches would be slower.
I think you have to try and measure. I've faced the same problem with
image decoding. The ImageI/O API contains an ImageInputStream which is
supposed to have some optimizations - even for bitwise, not only
bytewise operations. When I first worked on it a few years ago, I
found that writing some specific classes for specific cases (e.g.
reading 12 or 16 bits) was faster - in other words, the library didn't
provide the faster code. A few time later, I discovered that some
newer JRE was better and dropped some of my code because it was
useless. So, it's a matter of trying, measuring and re-measuring for
each JRE update.

- -- 
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
java.net/blog/fabriziogiudici - www.tidalwave.it/people
[email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxHTLUACgkQeDweFqgUGxcwxACeLpaYIPiaCCWZe4Q+mSPl4P6x
DMUAn2+o7vmQ32CxIcB+QobTB6Vov4ek
=F5Co
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to