I’m making a 3d rendering demo using p5, but I’m depressed because I notice that javascript doesn’t have SIMD and thus cannot perform fast vector caculation. Should I switch to c or c++? p5 is a really good platform and here are some work that I’ve done:
I’m not sure what you mean by “javascript doesn’t have SIMD.” Web browsers have WebGL, WebGL supports GLSL shaders, GLSL shaders are, in essence, Single Instruction Multiple Data programs. JavaScript vs C++ has got nothing to do with it, since really they are just programming languages. There are some things that OpenGL (which you could use from C++, or JavaScript in Node.js technically) supports, but WebGL does not (such as Geometry Shaders for example). If you really want to do multi-core parallel programming in JavaScript you can look into WebWorkers, but this will not be nearly as performant as a WebGL shader.
If the code can be written to shaders, yes it’s fast. But there are some codes or algorithms that are not easily to be implemented on webgl shaders( for example the ray tracing acceleration structure ). I’m currently doing some vector calculations on cpu, and it heavily relies on the single core performance of cpu. Once there was SIMS.js, but I’m not sure why it’s been abandoned.
I wish I had more time to look into some of this because I’m pretty convinced that you could get some really incredible performance out of JavaScript with some of these techniques.