Experimenting with Processing.js
I eventually got round to trying out Processing.js - the javascript implementation of the original Processing. You can see the result below in a little experiment called Fireflies.
Fireflies
(View in Google Chrome/Firefox)
I actually ported this from a javascript experiment I did around the same time as the snowfall one. I thought it would be a good idea to see how regular JS performed alongside Processing.js. You can check out the regular javascript version for comparison. I tried to ensure they both looked identical and were coded as similarly as possible. The verdict is that they both perform smoothly, but Processing.js seems to require about 20% more CPU than regular JS, for what reason I don’t quite know. I haven’t looked into the Processing source code to see what’s going on. Processing has a neater syntax and less overall code, and it even sorted out scoping issues I had in the regular version, so it wins on that front.
I’d be interested to use it some more, although I’m unsure of what benefits it offers over regular JS. The syntax is certainly nicer, but the typed variables tempt me with the facade of proper OO - it’s ultimately converted to javascript so I know it doesn’t offer any practical advantage. I think it would require further investigation to see the real benefits.
Oh, I hit a couple of hurdles early on that had me stumped for ages. The beginners guide to Processing.js is lacking some vital information, so if you’re stuck on how to actually set up it in your HTML page then follow the points below:
Posted: May 3rd, 2010 under Javascript.
Comments: 1

