JSPM

  • Created
  • Published
  • Downloads 16600
  • Score
    100M100P100Q172007F
  • License BSD-2-Clause

fast-async/await transformer Babel plugin

Package Exports

  • fast-async

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fast-async) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fast-async

'fast-async' is a Babel v6.x.x plugin that implements the ES7 keywords async and await using syntax transformation at compile-time rather than generators.

The main reason for using 'fast-async' as opposed to Babel's default implementation of async/await is performance (https://github.com/MatAtBread/nodent#performance) - it's 3-4 times faster in a browser/node, and as much as 10 times faster on a mobile browsers, mainly due to avoiding generators (and therefore regenerator).

There's a simple test (that just makes sure the plugin works and generates code that runs). More complete test coverage is included with nodent.

fast-async (via nodent) can generate code suitable for use in early Browsers with no Promise support (as well as no generators), and has various options for turning sourcemaps on/off and controlling code generation, however for now it simply chooses some defaults.

Because Babel parses the code, the ES7 extensions possible with nodent (await anywhere, async return and async throw) are not supported, however full implementation of async function containing await expressions is implemented.

For Babel v5.x.x install fast-async@1.0.3

Install

npm install fast-async

Test

From the installation directory (e.g. node_modules/fast-async):

npm test

Online performance checkers:

  • nodent 632ms (and shave off another 100ms by selecting 'Pure ES5' mode)
  • babel 1877ms - 3x slower
  • traceur 2488ms - 4x slower