Re: Does Glowscript have numpy-like performance?

Bruce Sherwood <[email protected]> Mon, 11 Jun 2012 23:34:25 -0600
Newsgroups gmane.comp.python.visualpython.user
Message-ID <CAFDG03g+EdQsLYdeMxxKF3HmXAE=ZMsHAPqPNnrehfM1XWEpig@mail.gmail.com>
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 <[email protected]> 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

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Visualpython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/visualpython-users