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 |
On Friday, 10 February 2017 11:58:13 GMT Norbert Vischer wrote:
> 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? Hi Norbert, I think this window select and window create slowdowns have been going on since 1.7. Your macro is not slow on my machine (linux) (10 to 11 ms per image) but there is a very noticeably difference in speed in the "Stack to Images" command between 1.6 and 1.8. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by vischer
> On Feb 10, 2017, at 5:58 AM, Norbert Vischer <[hidden email]> wrote:
> > 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? The latest ImageJ daily build (1.51k5) reduces the selectImage() timeout to 250 ms when ImageJ is running on OS X and Java 8. The timeout is the amount of time selectImage() waits for the image window to be activated. On OS X and Java 8, the window activated event sometimes does not occur after selectImage() calls toFront() on the image window. -wayne > 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 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Wayne and Gabriel,
> The latest ImageJ daily build (1.51k5) reduces the selectImage() timeout to 250 ms when ImageJ is running on OS X and Java 8. The timeout is the amount of time selectImage() waits for the image window to be activated. On OS X and Java 8, the window activated event sometimes does not occur after selectImage() calls toFront() on the image window. > > -wayne thanks Wayne for the work-around. Now about every second call hits the 250 ms, so I wonder what will be the disadvantage in these cases? The modified macro (below) makes tests in 4 loops, where loop 3 and 4 introduce BatchMode statements. This reduced the time to 0 msec. Norbert ImageJ 1.51k5; Java 1.8.0_101 [64-bit]; Mac OS X 10.10.3; 15MB of 3000MB (<1%) //--- macro (with BatchMode statements) 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 <= 4; loop++){ print(loop); for(num=1; num <=6; num++){ title = "Img_" + num; time = getTime; if(loop>2) setBatchMode(true); selectImage(title); if(loop>2) setBatchMode(false); print(title, "time[ms]: ", getTime-time); } } selectWindow("Log"); //--- macro end Output: ======= 1 Img_1 time[ms]: 60 Img_2 time[ms]: 31 Img_3 time[ms]: 254 Img_4 time[ms]: 58 Img_5 time[ms]: 263 Img_6 time[ms]: 23 2 Img_1 time[ms]: 57 Img_2 time[ms]: 32 Img_3 time[ms]: 253 Img_4 time[ms]: 36 Img_5 time[ms]: 261 Img_6 time[ms]: 23 3 Img_1 time[ms]: 0 Img_2 time[ms]: 0 Img_3 time[ms]: 0 Img_4 time[ms]: 0 Img_5 time[ms]: 0 Img_6 time[ms]: 0 4 Img_1 time[ms]: 0 Img_2 time[ms]: 0 Img_3 time[ms]: 0 Img_4 time[ms]: 0 Img_5 time[ms]: 0 Img_6 time[ms]: 0 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
While we are discussing this, I'll mention this other issue (I think I have
posted about it before, but I do not seem to be able to search the list archive to check if I did, for some reason). The macro below is about 7 times slower in java 8 and 7, compared with java 6 in linux when you run in "Normal mode": setBatchMode(true); run("MRI Stack (528K)"); t=getTime(); run("Stack to Images"); print ("Batch mode: "+getTime()-t); run("Images to Stack", "name=Stack title=[] use"); setBatchMode(false); t2=getTime(); run("Stack to Images"); print ("Normal mode: "+getTime()-t2); run("Images to Stack", "name=Stack title=[] use"); Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Gabriel,
on my Macbook Air, Java 8 is factor 1.3 slower: Java 6: ImageJ 1.51j15; Java 1.6.0_65 [64-bit]; Mac OS X 10.10.3; 8554K of 3000MB (<1%) Batch mode: 5 Normal mode: 3165 Java 8: ImageJ 1.51k5; Java 1.8.0_101 [64-bit]; Mac OS X 10.10.3; 39MB of 3000MB (1%) Batch mode: 2 Normal mode: 4264 Best regards, Norbert > While we are discussing this, I'll mention this other issue (I think I have > posted about it before, but I do not seem to be able to search the list > archive to check if I did, for some reason). > The macro below is about 7 times slower in java 8 and 7, compared with java 6 > in linux when you run in "Normal mode": > > setBatchMode(true); > run("MRI Stack (528K)"); > t=getTime(); > run("Stack to Images"); > print ("Batch mode: "+getTime()-t); > run("Images to Stack", "name=Stack title=[] use"); > setBatchMode(false); > t2=getTime(); > run("Stack to Images"); > print ("Normal mode: "+getTime()-t2); > run("Images to Stack", "name=Stack title=[] use"); -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Sunday, 12 February 2017 16:33:26 GMT Norbert Vischer wrote:
> on my Macbook Air, Java 8 is factor 1.3 slower: Thanks Norbert, I tried also openjdk 1.8 and it is as slow as the oracle Java. I do not think it is a window manager (KDE) issue, otherwise Java 1.6 would be slow too. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |