selectImage(title) is slow in Java 8

Posted by vischer on
URL: http://imagej.273.s1.nabble.com/selectImage-title-is-slow-in-Java-8-tp5018076.html

Hi all,

the macro below shows that "selectImage(title)" often has a 2000 ms wait time.
I did not observe this in Java 6. Is there an easy fix?

Norbert




ImageJ 1.51k4; Java 1.8.0_101 [64-bit]; Mac OS X 10.11.3; 37MB of 7000MB (<1%)

//--- macro begin
run("Close All");
for(num=1; num <=6; num++){
        title = "Img_" + num;
        newImage(title, "8-bit ramp", 800, 600, 1);

}
print("\\Clear");
for(loop = 1; loop <= 3; loop++){
        print(loop);
        for(num=1; num <=6; num++){
                title = "Img_" + num;
                time = getTime;
                selectImage(title);
                print(title,  "time[ms]: ", getTime-time);
        }
}
//--- macro end

output:
=======
1
Img_1 time[ms]:  13
Img_2 time[ms]:  11
Img_3 time[ms]:  2004
Img_4 time[ms]:  11
Img_5 time[ms]:  21
Img_6 time[ms]:  13
2
Img_1 time[ms]:  10
Img_2 time[ms]:  10
Img_3 time[ms]:  2002
Img_4 time[ms]:  13
Img_5 time[ms]:  10
Img_6 time[ms]:  2007
3
Img_1 time[ms]:  20
Img_2 time[ms]:  10
Img_3 time[ms]:  11
Img_4 time[ms]:  2013
Img_5 time[ms]:  11
Img_6 time[ms]:  13

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html