Re: Does Glowscript have numpy-like performance?
Bruce Sherwood <[email protected]> Sun, 10 Jun 2012 21:59:29 -0600
| Newsgroups | gmane.comp.python.visualpython.user |
|---|---|
| Message-ID | <CAFDG03gnDtpvLE+WC6qAsgs_ZU0zC58YVdUDUQG2O_qbcoRY9A@mail.gmail.com> |
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/