[ImageJ-devel] [fiji-devel] [imglib2] converters slow and incorrect?

Albert Cardona sapristi at gmail.com
Mon Jun 24 07:10:22 CDT 2013


2013/6/24 Tobias Pietzsch <pietzsch at mpi-cbg.de>

>
>
> First regarding the slow (feel free to skip to this paragraph...). I
> played with unsigned short to ARGB conversion and noticed that it divides
> by scale factor for every pixel.
> I thought that maybe we could speed it up a little by replacing that with
> a multiplication. Amazingly even in a language as Java that is seemingly
> far removed from the CPU this actually matters.
>



Just wanted to point out that this particular surprise with division, in
Java, I've run into before. Another aspect of it: for whatever reason the
compiler or JIT are unable to map divisions by powers of two to a bit
shift. For example:

int d = 16;
int a = 4096 / d;

... is about substantially slower (15 to 50%) than:

int s = 4;
int a = 4096 >> s;

... to the same result.

Albert



http://albert.rierol.net
http://www.ini.uzh.ch/~acardona/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20130624/1c975af2/attachment.html>


More information about the ImageJ-devel mailing list