Hi Bob and others,

do you think that there might be some potential for optimizing the loop 
speed in Jmol scripts, maybe by reducing flexibility or disabling 
interruptions?

For my current project my loops can easily get into the range of 
millions and even billions of cycles.

I have done some loop speed tests comparing Javascript (see 
http://www.fli-leibniz.de/~rhuehne/jmol/javascript_loop_speedtest.html) 
and Jmol (see function below) using Java and HTML5.

---- Jmol Speed Test Function -------------------
function stest(iMax, iterationCount, systemName) {
   var startTime = now();
   var counter = 0;
   for (j=1; j<=iterationCount; j++) {
     for (i=1; i<=iMax; i++) {
       counter++;
     }
   }
   var duration = now(startTime);
   print "" + systemName + ": Iterations=" + iterationCount + "; Loop 
size=" + iMax + "; Counter=" + counter + "; Total time=" + duration + " 
ms;  Time per iteration=" + (1.0 * duration / iterationCount) + " ms";
}

-------Speed Test Results --------------------------

Test System: Linux, OpenSuse 12.2, IcedTea Java 1.7.0_45

1) Javascript in Firefox 37 needs about 5 milliseconds for a loop with 
100000 cycles:

Mozilla/5.0 (X11; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0: 
Iterations=100; Loop size=100000; Counter=10000000; Total 
time=510.5227709999999 ms; Time per iteration=5.105227709999999 ms

2) Javascript in Chrome 31 needs about 10 milliseconds for a loop with 
100000 cycles:

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) 
Chrome/31.0.1650.63 Safari/537.36 SUSE/31.0.1650.63: Iterations=100; 
Loop size=100000; Counter=10000000; Total time=1070.5220000818372 ms; 
Time per iteration=10.705220000818372 ms

3) Jmol 14.3.13 using Java needs about 270 milliseconds for a loop with 
100000 cycles:

JMOL/JAVA: Iterations=100; Loop size=100000; Counter=10000000; Total 
time=26756 ms;  Time per iteration=267.56 ms for a loop with 100000 cycles:

4) Jmol 14.3.13 using HTML5 in Firefox 37 needs about 20000 milliseconds 
for a loop with 100000 cycles:

JMOL/HTML5/FIREFOX: Iterations=10; Loop size=100000; Counter=1000000; 
Total time=196765 ms;  Time per iteration=19676.5 ms

5) Jmol 14.3.13 using HTML5 in Chrome 31 needs about 19000 milliseconds 
for a loop with 100000 cycles:

JMOL/HTML5/CHROME: Iterations=10; Loop size=100000; Counter=1000000; 
Total time=189565 ms;  Time per iteration=18956.5 ms

6) Jmol 14.0.5 using HTML5 in Firefox 37 needs about 24000 milliseconds 
for a loop with 100000 cycles:

JMOL/HTML5/FIREFOX: Iterations=3; Loop size=100000; Counter=300000; 
Total time=71250 ms;  Time per iteration=23750 ms

-------------------------------------------------

So Javascript is about 30-60 times faster than Jmol 14.3.13/Java and 
about 3800-4000 times faster than Jmol 14.3.13/HTML5.

And Jmol 14.3.13/Java is about 70-74 times faster than Jmol 14.3.13/HTML5.
This is much higher than the factor 10 that I generally observed between 
Jmol 14.0.5/Java and Jmol 14.0.5/HTML5 on my system.

I did the comparison with Javascript because I wanted to know how much I 
could maximally gain for Jmol/HTML5 if I would try to extend Jmol in 
Java instead of by Jmol scripts. And I wanted to now how much potential 
there might maximally be for optimizing Jmol script speed.

You might ask yourself why I am especially interested in loop speed 
optimization. The reason is that there exists an optimization option for 
the algorithm I am implementing which has a large overhead. This 
overhead increases the number of loop cycles more than 10fold. But in 
more than 90% of the cycles almost nothing has to be done.

Regards,
Rolf
-- 

Rolf Huehne
Postdoc

Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI)
Beutenbergstrasse 11
07745 Jena, Germany

Phone:   +49 3641 65 6205
Fax:     +49 3641 65 6210
E-Mail:  rhue...@fli-leibniz.de
Website: http://www.fli-leibniz.de

           Scientific Director: Prof. Dr. K. Lenhard Rudolph
        Head of Administration: Dr. Daniele Barthel
Chairman of Board of Trustees: Dennys Klein

VAT No: DE 153 925 464
Register of Associations: No. 230296, Amtsgericht Jena
Tax Number: 162/141/08228


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to