Skip to content Skip to sidebar Skip to footer

Strange Limitation In Arraybufferview Constructor

The TypedArray specification states that an ArrayBufferView may be created this way: TypedArray(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigne

Solution 1:

This restriction was imposed in order to maintain maximum performance for the typed array views such as Uint16Array and Float32Array. These types are designed to operate on data in the machine's natural alignment. Supporting unaligned loads would either slow down the fast case unacceptably, or lead to performance "cliffs" where programs would mostly run fast, except when they slowed down by a large factor.

DataView is designed to support unaligned loads and stores of single elements of data, specifically to handle the case of networking or disk I/O, where file formats may not have any alignment restrictions.

Post a Comment for "Strange Limitation In Arraybufferview Constructor"