От: | rFLY | ||
Дата: | 10.06.24 20:29 | ||
Оценка: | 18 (1) |
P>globalThis.sum += val
P>
//let sum = 0;
let o = {sum: 0};
for (let i = 0; i < 100_000_000; i++)
{
let obj = new BaseClass();
let val = obj.TestMethod();
//sum += val;
o.sum += val;
}
противс let sum = 0
4999999950000000
1: 408.7000002861023
4999999950000000
2: 390.7999997138977
с let o = {sum: 0};
4999999950000000
1: 409.40000009536743
4999999950000000
2: 271.69999980926514