https://github.com/naugtur/node-example-deopt
https://github.com/naugtur/node-example-deopt
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/naugtur/node-example-deopt
- Owner: naugtur
- License: mit
- Created: 2017-06-09T13:39:10.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-09T16:42:41.000Z (over 8 years ago)
- Last Synced: 2025-02-15T07:44:15.373Z (8 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# (de)optimization) exercise
## Observe a deoptimization
run `node --trace-opt --trace-deopt 1deopt.js` and see a clean example of single deoptimization.
In real life it's much less readable ;)
## Testing if a function can be optimized
`testing.js` has some examples of functions that can prevent optimization.
Run `node testing.js` and see how they do in different versions of node.use [n](https://www.npmjs.com/package/n) `npm install -g n` or get [nvm](https://github.com/creationix/nvm/blob/master/README.md) to switch node versions.
## Try optimizing a function
`fixable.js` is a module with a trivial parser, but it has a few issues preventing optimization.
Try fixing the optimization issues without breaking any functionality.
Run `npm test` to verify if you succeeded.`test/spoilers/fixed.js` contains a solution