7 ms·
Does there have to be such a big performance penalty? I remember flash games working really fast on my phone. However, when a bunch of (~100?) circles appeared
by lqdc13 9y ago
Does there have to be such a big performance penalty?
I remember flash games working really fast on my phone. However, when a bunch of (~100?) circles appeared on the screen, the video started lagging.
I wonder if games/animations compiled to webassembly would work a lot faster.
- TheOtherHobbes 9y agop5.js and processing.js are really for educational and artistic doodling, not for commercial web design. There aren't many applications where d3 or raw js wouldn't be a more performant solution for commercial graphics.
- vanderZwan 9y agoYou might be thinking of Processing.js, which is fairly slow because it tries to interpret plain processing code, which is Java, not JavaScript[0]. p5 defaults to either canvas or WebGL and uses abstractions barely add any overhead to raw JS. Where sensible it uses typed arrays internally[1], for example. By comparison, d3 uses SVG and DOM manipulation by default, and everything is trees of objects (as a consequence, creating datavisualisations is also done an entirely different style, btw, since p5 uses a draw-loop for each frame, and d3 uses an enter/update/exit paradigm). So unless you manually take steps to use the canvas (which is possible, but not the default), I doubt that d3 usually beats p5 (pixi however, is another story[2]). But really, as long as you know how to write fast JS code, you can write fast p5 code. EDIT: note that the examples are not necessarily the fastest possible code, since they are more about showing code examples. [0] http://processingjs.org/learning/ http://processingjs.org/learning/ [1] https://p5js.org/reference/#/p5/pixels https://p5js.org/reference/#/p5/pixels [2] http://www.pixijs.com/ http://www.pixijs.com/
- deleted 9y ago[deleted]