js ArrayBufferView & TypeArray All In One
// ✅ > 100000
2**64;
18446744073709552000
// ✅ > 100000
2**32;
4294967296
// ❌ 太小了 < 100000
2**16;
65536
// ❌ 太小了 < 100000
2**8;
256
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
Uint8Array
js no for 100 array
const arr = new Uint8Array(100).map((item, i) => i);
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array
Uint32Array
js 数组里面有10万个数据,取第 1 个元素和第 10 万个元素的时间相差多少?
const arr = (new Uint32Array(100000)).map((item, i) => i + 1);
function testPerformance(arr, i) {
let startTime = performance.now();
console.log(`arr[i], i =`, arr[i], i);
let endTime = performance.now();
console.log(`
标签:Web,arr,console,ArrayBufferView,js,Objects,https,TypeArray,developer
From: https://www.cnblogs.com/xgqfrms/p/16721287.html