From: Bruce S. <Bru...@nc...> - 2012-06-12 05:34:35
|
The plot thickens. David Scherer rewrote a small piece of the GlowScript gas example, and the time on both Chrome and Firefox dropped to 1 second, not so different from the 0.4 second seen with the numpy version. (The change has to do with disabling vector overloading in the GlowScript handling of JavaScript.) Bruce Sherwood On Sun, Jun 10, 2012 at 9:59 PM, Bruce Sherwood <Bru...@nc...> wrote: > After more study of GlowScript vs. VPython versions of the VPython > gas.py program: > > VPython gas.py with 100 atoms, dt = 1e-5, rate 500, no graphing: 100 > iterations = 0.4 seconds. > > If gas.py is modified to not use numpy, the time is 3.6 s. > > The similar Glowsript program with same conditions: 100 iterations = > 3.2 seconds on Firefox. > > Oddly, on at least one 64-bit Windows machine, the time is 5.3 seconds > on Chrome. > > On a 32-bit Windows laptop, 4.2 seconds on Firefox, 2.5 seconds on > Chrome, the reverse of the ordering on the other Windows machine. > > There is a very major difference between Chrome and Firefox. With > Firefox, the animation periodically freezes, probably due to > JavaScript garbage collection. These freeze-ups do not occur with > Chrome or Safari. > > ----------------------- > > You can run this program (if you have a WebGL-enabled browser; see the > Help at glowscript.org) at > > http://www.glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/HardSphereGas > > A summary statement is that the factor of 10 speed advantage of > VPython over GlowScript comes completely from the parallel C-speed > numpy arrays. Without numpy, the VPython and GlowScript (Python and > JavaScript) execution speeds are about the same. I had mistakenly > thought that JavaScript was much faster than Python, but that seems > not to be the case. > > Bruce Sherwood |