3 ms·
You 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
by vanderZwan 9y ago
You 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/