3 ms·
I just mean you won’t write a video codec or a 3d renderer in JS. It will never get there. Just leave these things to WebAssembly where needed and leave JS as a
by szastamasta 2y ago
I just mean you won’t write a video codec or a 3d renderer in JS. It will never get there. Just leave these things to WebAssembly where needed and leave JS as a slow, dynamic language we use for web apps.
- tantalor 2y agoIt's a false dichotomy. Computers are fast. You should be able to write fast computer programs in any language. The limiting factor on a program's performance should be the design of algorithms and data structures, not the programmer's choice of language or runtime.
- wiseowise 2y ago> I just mean you won’t write a video codec or a 3d renderer in JS. Not with the attitude, you don’t. > Just leave these things to WebAssembly where needed and leave JS as a slow, dynamic language we use for web apps. The ship has sailed when they made V8 and performance race has started.
- meheleventyone 2y ago3D renderers have existed in JS for ages so that seems more like a failure of imagination on your part. The nice thing about fixed layout structs is that it leans in to optimizations people are already doing based on the behavior of JS engines where 'shapes' of objects are important and properties can be looked up by offset if you keep your code monomorphic. It can be a bit of a headache to enforce this and you can accidentally fall off a performance cliff if you end up with many 'shapes' for the same thing. By making this a language feature it codifies and blesses what was essentially a hack relying on the implementation of the underlying engine that could change at any time. There are also TypedArray's that do provide a bunch of cache friendly (but slightly unergonomic) ways to organize data. A good resource for the sorts of things people are doing to write high-performance JS is here: https://romgrk.com/posts/optimizing-javascript https://romgrk.com/posts/optimizing-javascript