refactor(ivy): move all of the instruction state into a singe object (#33093)
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
This commit is contained in:

committed by
Matias Niemelä

parent
43487f6761
commit
bb53b6549c
@ -12,7 +12,7 @@
|
||||
"master": {
|
||||
"uncompressed": {
|
||||
"runtime": 1440,
|
||||
"main": 13415,
|
||||
"main": 14228,
|
||||
"polyfills": 45340
|
||||
}
|
||||
}
|
||||
@ -21,7 +21,7 @@
|
||||
"master": {
|
||||
"uncompressed": {
|
||||
"runtime": 1440,
|
||||
"main": 123904,
|
||||
"main": 125674,
|
||||
"polyfills": 45340
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user