Am 03.04.15 um 03:55 schrieb Robert Hanson: > Rolf, you are definitely pushing the limit there, I think. What exactly > happens inside the loop you are really interested in using? If it is > anything much, then the looping itself is going to be insignificant > compared to the other processing. > Bob, the commands inside the loops take about two thirds of the whole time (see simplified example below with constant subnodeCount). So the loops take about one third and a loop speedup of a factor of 10 could reduce the overhead running time by 30% (e.g.: 2 minutes instead of three minutes or two hours instead of three hours).
I might also try a different optimization called 'Octree' which is said to be more efficient than the 'grid' optimization below to identify pseudoatom pairs near enough to each other for having significant influence onto each other. I also considered implementing the algorithm in Javascript instead of Jmolscript to compensate for the slower JSmol speed. But it must also work in the Java applet and the application. And I would rather like to avoid any "dangerous" methods of variable exchange between Javascript and Jmol. Angel, reversing the loop doesn't change anything in Jmol/Java. I havn't checked Jmol/HTML5 yet. -------- Simplified Example ------------- function sTest1(iMax) { var gridKeyList = []; var gridMembers = {}; for (var i=iMax; i>=1; i--) { var gridKey = "val" + i; gridKeyList[i] = gridKey; gridMembers[gridKey] = {}; var averageMemberCount = 3; var nodeNoToIndex = {"1": 1, "2": 2, "3": 3}; for (var j=averageMemberCount; j>=1; j--) { gridMembers[gridKey].[j] = j; } } var pairKeys = {}; var counter2 = 0; var gridKeyCount = gridKeyList.size; if (gridKeyCount > 0) { var startTime = now(); for (var gridKey in gridKeyList) { var subNodeList = gridMembers[gridKey].keys; var subNodeCount = subNodeList.size; for (var si=1; si<subNodeCount; si++) { var nodeNo1 = subNodeList[si]; var i = nodeNoToIndex[nodeNo1]; for (var sj=subNodeCount; sj>si; sj--) { var nodeNo2 = subNodeList[sj]; var pairKey = "" + nodeNo1 + "|" + nodeNo2; counter2++; if (pairKeys[pairKey].size == 0) { } } } } } var duration = now(startTime); print "Loop size=" + iMax + "; Counter=" + counter2 + "; Total time=" + duration + " ms;"; } ---------------------------- Regards, Rolf ------------------------------------------------------------------------------ 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