I’m currently testing the pros and cons of using Three.js for a project where I would normally use openFrameworks, paying particularly close to performance and reliability over time (how long the app will run w/out crashing). I am using NW.js (Node-Webkit) to bundle the HTML/CSS/JavaScript into a desktop application. My initial results are surprising, as it seems that my openFrameworks version seems to be running at about half of the frame rate of the JavaScript version.
OpenFrameworks
JavaScript
The openFrameworks version maintains a steady 16 fps while the JavaScript version fluctuates between about 40-60 fps. The openFrameworks version looks perhaps a bit more crisp and the consistently of the slow frame rate keeps the sketch looking smooth (the JavaScript version is a bit jumpy). Below are links to both sets of code, if anyone would like to review what is actually going on. I’m not an efficiency expert, but the openFrameworks code is fairly optimized to my knowledge (I am purposefully avoiding the use of shaders).
I am less concerned with actual optimizations in these code versions as I am interested in discussing the validity of using web technologies in place of openFrameworks for select projects. Those familiar with Three.js and WebGL, are we nearing a point where the speed and efficiency of JavaScript w/ the V8 engine as it is applied to contexts like HTML5 Canvas and WebGL is “good enough”, especially for writing code that runs on a desktop (with something like NW.js)? I’m well aware that the abstraction that takes place w/ JavaScript makes it impossible to be as optimized as well written C++, but for many creative coding related projects is it a viable option for writing apps that need to perform consistently and for long periods of time w/out a restart? Are there any immediate red flags that are thrown when considering using Three.js + Node.js to execute a project normally fit for openFrameworks?
I’ve implemented the above project as a performance example that yielded somewhat cloudy results (OF runs smoother, but much slower). Are there any other testing metrics or processes that someone could recommend?