3 ms·
Can anyone explain why/how the following statement is true? We can then change the slow field read from current.obj[current.field] to current.getter(curren
by saurabhnanda 13y ago
Can anyone explain why/how the following statement is true?
We can then change the slow field read from current.obj[current.field] to current.getter(current.obj) which triples the performance.
- SchizoDuckie 13y agoMy guess would be that the array access method first parses the whole object as an array, breaking optimisations made possible with JIT compiling, whereas getters and setters are preoptimized because they're the actual standard way of accessing object properties.