Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shift feet from Q to Promise.prototype
This puts primary implementations of all methods onto the promise prototype. Instead of channeling all of the interface through as few functions as possible, passes all implementations through as few stack frames as possible. Both Q and Promise.prototype implementations are unrolled. This should improve performance in various ways. For one, we do not need to check or coerce the source promise if we're being called as a prototype method. Since we do not have a benchmarking system of any appreciable sophistication, I will refrain from posting any numbers, but the speed of running our test suite does not change significantly. Unrolling the prototype methods does increase code size but increases redundancy. The minified size increases by 2kb and the gzip size increases by about 200 bytes. Before: Original: 53148 bytes. Minified: 12245 bytes. Gzipped: 2535 bytes. After: Original: 56478 bytes. Minified: 14254 bytes. Gzipped: 2725 bytes. Although we are no longer generating prototype methods from a list of names of methods on the Q object, the code coverage did not change significantly. Our report shows 90% both before and after.
- Loading branch information