JavaScript typed arrays

‘JavaScript typed arrays are array-like objects that provide a mechanism for reading and writing raw binary data in memory buffers.’

Type Value Range Size in bytes Description Web IDL type Equivalent C type
Int8Array -128 to 127 8-bit two’s complement signed integer byte int8_t

Example of one typed array type, from MDN

What are these used for? Often in image editing etc. Raw data processing. Storing specific types of data, the arrays can be much smaller in memory etc.

References

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays

Faster Canvas Pixel Manipulation with Typed Arrays

#programming #review