/will-it-optimize

Suite of tests for determining what v8 will optimize

Primary LanguageJavaScriptMIT LicenseMIT

will-it-optimize

Current Version

I don't care if something will blend (well, I kind of do). I want to know if something can be optimized by v8. will-it-optimize reports whether or not a function can be optimized based on its contents. Hopefully, this will make it easier to track what can be optimized in various versions of node.js without paying extremely close attention to the v8 codebase.

Running the Tests

npm start

Test Structure

A test is defined by the module.exports object. The following properties are supported:

  • description - String. A written description of the test. Markdown is allowed.
  • exec - Function. The test code to execute.
  • args - Optional Array. Arguments passed to the test code.
  • warmup - Optional Array. Array of objects used to warmup v8. If warmup is not specified, the test function will be invoked once using args as the arguments. Each object in the array results in an invocation of the test function. This is used to fill in v8's type info. Each object may contain the following fields:
    • args - Optional Array. Arguments passed to the test code on the given warmup iteration.

An example test is shown below. This will execute a function containing a with statement, which v8 cannot currently optimize.

module.exports = {
  description: '`with` statement',
  exec: function exec() {
    with ({}) {}
  }
};

Required Reading