2013/6/24 Tobias Pietzsch <pietz...@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/
_______________________________________________
ImageJ-devel mailing list
ImageJ-devel@imagej.net
http://imagej.net/mailman/listinfo/imagej-devel

Reply via email to