Message from JavaScript discussions

February 2018

— JS Arrays are completely dynamic, they can contain elements of any time, different types at the same time, grow and shrink, etc

Message permanent page


But yes, they do have this problem in JS. V8 may do some magic to optimize this, but the bigger question is:
Why are you storing huge arrays in JS?

— JS is not great for CPU-heavy operations

— It's perfect for streaming, data-heavy apps, and I/O

— In JS you generally don't want or need that much data in-memory at once

— What do you mean by streaming?

— Streaming data

— Reading from disk, pushing to a socket

— Reading from a socket, pushing to another socket

— That kind of stuff

— Pumping data through the app in chunks

— Not reading everything in at once