Changes between Version 2 and Version 3 of JavaScript performance improvement ideas
- Timestamp:
- Oct 19, 2007, 9:35:58 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
JavaScript performance improvement ideas
v2 v3 9 9 * Generational mostly-copying garbage collector. This one is likely to be pretty hard. 10 10 11 * use bytecode or something similar to make the interpreter non-recursive so it doesn't use so much stack. But the inner loop has to be coded carefully because obvious ways of doing will regress performance instead of speeding it up.11 * Use bytecode or something similar to make the interpreter non-recursive so it doesn't use so much stack. But the inner loop has to be coded carefully because obvious ways of doing will regress performance instead of speeding it up. (direct threading, subroutine threading, context threading) 12 12 13 13 * Constant folding. This could be done purely by the parser, for strings, numbers, even regexps. … … 20 20 21 21 * Scalable Array implementation so that JS arrays don't just "fall off the cliff" when they get over the size threshold. One possible idea is that you expand the storage if items are added close to the current end of the storage. Another possibility is using a more general sparse array implementation. 22 23 * Lightweight type inference. A lot of operators take needless virtual calls and branches because they behave differently depending on whether the operands are strings or numbers, etc. A lot of this can be eliminated based on even the most basic knowledge of operand types, which can be inferred based on constants in the code and output types of operators. 24 25 * Micro-optimize double --> JSImmediate and JSImmmediate --> int conversions. 26 27 * Where possible, combine toPrimitive() conversion with later toString() / toNumber() call.