npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

is-optimizable

v1.1.1

Published

A tool that checks for V8 optimization killers

Downloads

981

Readme

is-optimizable

Build Status Dependency Status devDependency Status

A tool that checks for V8 optimization killers. Based on the list on the bluebird wiki.

Usage


Usage: is-optimizable <files>... [options]

files     The list of files to check optimizability for.

Options:
   --encoding              Input file encoding  [UTF-8]
   --harmony               Parse as ES6
   --disallow-lonely-try   Don't allow try/catch/finally as only thing inside a function.

Example

marten@procyon:~/git/is-optimizable$ ./bin/is-optimizable --harmony test/problems.js
test/problems.js: line 1: global code: debugger statement
test/problems.js: line 4: function 'a': debugger statement
test/problems.js: line 7: function 'test': generator function
test/problems.js: line 10: function 'unnamed function': generator function
test/problems.js: line 13: global code: for .. of statement
test/problems.js: line 16: global code: try/finally statement
test/problems.js: line 17: global code: try/catch statement
test/problems.js: line 18: global code: try/catch/finally statement
test/problems.js: line 21: global code: object literal includes a get declaration
test/problems.js: line 24: global code: object literal includes a set declaration
test/problems.js: line 27: global code: object literal includes a __proto__ property
test/problems.js: line 31: global code: possible eval() call
test/problems.js: line 32: global code: possible eval() call
test/problems.js: line 34: global code: with statement
test/problems.js: line 38: global code: switch statement with more than 128 cases
test/problems.js: line 175: function 'c': possibly unsafe 'arguments' usage
test/problems.js: line 190: function 'f': possibly unsafe 'arguments' usage
test/problems.js: line 195: function 'f': reassignment of argument 'a' while 'arguments' is referenced in the same function body
test/problems.js: line 196: function 'f': possibly unsafe 'arguments' usage
test/problems.js: line 211: function 'g': possibly unsafe 'arguments' usage
test/problems.js: line 221: function 'i': possibly unsafe 'arguments' usage
marten@procyon:~/git/is-optimizable$ 

Ignore lines

You can ignore warnings by adding a comment containing the text 'is-optimizable ignore next' exactly one line ahead of the line causing the error. E.g.:

var a = 1;
try {} finally {}
var b = 2;

becomes:

var a = 1;
/* is-optimizable ignore next */
try {} finally {}
var b = 2;

Wishlist/TODO

  • compound let assignment - rare so not yet implemented
  • compound const assignment - rare so not yet implemented
  • check for .. in - it's efficiency is largely runtime dependant though.

PRs welcome!

License

ISC