mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Turns out that writing to global state is more expensive than writing to
a property on an object.
Slower:
````
let count = 0;
function increment() {
count++;
}
```
Faster:
````
const state = {
count: 0
};
function increment() {
state.count++;
}
```
This change moves all of the instruction state into a single state object.
`noop_change_detection` benchmark
Pre refactoring: 16.7 us
Post refactoring: 14.523 us (-13.3%)
PR Close #33093
47 lines
1.1 KiB
JSON
47 lines
1.1 KiB
JSON
{
|
|
"cli-hello-world": {
|
|
"master": {
|
|
"uncompressed": {
|
|
"runtime": 1497,
|
|
"main": 154699,
|
|
"polyfills": 45399
|
|
}
|
|
}
|
|
},
|
|
"cli-hello-world-ivy-minimal": {
|
|
"master": {
|
|
"uncompressed": {
|
|
"runtime": 1440,
|
|
"main": 14228,
|
|
"polyfills": 45340
|
|
}
|
|
}
|
|
},
|
|
"cli-hello-world-ivy-compat": {
|
|
"master": {
|
|
"uncompressed": {
|
|
"runtime": 1440,
|
|
"main": 125674,
|
|
"polyfills": 45340
|
|
}
|
|
}
|
|
},
|
|
"cli-hello-world-ivy-i18n": {
|
|
"master": {
|
|
"uncompressed": {
|
|
"runtime": 1440,
|
|
"main": 141209,
|
|
"polyfills": 45949
|
|
}
|
|
}
|
|
},
|
|
"hello_world__closure": {
|
|
"master": {
|
|
"uncompressed": {
|
|
"bundle": "TODO(i): temporarily increase the payload size limit from 105779 - this is due to a closure issue related to ESM reexports that still needs to be investigated",
|
|
"bundle": "TODO(i): we should define ngDevMode to false in Closure, but --define only works in the global scope.",
|
|
"bundle": 177447
|
|
}
|
|
}
|
|
}
|
|
}
|