3 ms·
Interesting what you say about struct-of-arrays, I have been following this topic closely recently. Do you know any well known JS code implemented using struct-
by warpech 7y ago
Interesting what you say about struct-of-arrays, I have been following this topic closely recently. Do you know any well known JS code implemented using struct-of-arrays or have some interesting resources about it? I am worried that SoA codebase is difficult to maintain and hard to express in a simple API.
I have been reading two resources about it, https://ourmachinery.com/post/data-structures-part-1-bulk-data/ https://ourmachinery.com/post/data-structures-part-1-bulk-da... and https://stackoverflow.com/questions/39799874/why-does-javascript-process-an-array-of-structures-faster-than-a-structure-of-ar https://stackoverflow.com/questions/39799874/why-does-javasc....
- IshKebab 7y agoNo, sadly most Javascript APIs seem to use array-of-structs. It is definitely easier to write the code that way. I suspect most graphing libraries start out like that and then by the time they try to plot a heat map with a million points it is too late to fix. Traditionally plotting libraries like Matlab and Matplotlib work on arrays of data.
- mbostock 7y agoHere is a notebook on the subject. I’d also check out Apache Arrow. https://observablehq.com/@mbostock/manipulating-flat-arrays https://observablehq.com/@mbostock/manipulating-flat-arrays
- TeMPOraL 7y agoThank you for that. For the first time I finally understood what the Apache Arrow is - until today, I didn't realize it's just a way to do SoA in different languages + a lot of buzzwords.
- foota 7y agoIt's in a different domain, but you might be interested in unity (the game engines) data oriented stack. Basically it serializes properties attached to an entity, which you then write systems that map against entities with certain combinations of properties attached. Seems like this could be amenable to JavaScript as well.