Created by: timdorr
fast-async is based on nodent, a generator-optional implementation of async/await support.
By default, it does not use generators, which saves the usage of regenerator if generator functions are not otherwise used. It is also significantly faster, with order-of-magnitude perf gains on mobile browsers in particular.
It also smaller, reducing gzipped file size by 1.44KB in a simple test case:
File sizes after gzip:
48.7 KB (+1.44 KB) build/static/js/main.c60c74db.js
289 B build/static/css/main.9a0fe4f1.css
Test case code:
class App extends Component {
async componentDidMount() {
try {
const response = await fetch('https://jsonplaceholder.typicode.com/posts/1');
const data = await response.json();
console.log(data);
} catch (lol) {
alert('oh noes')
}
}
//...
}
I'm not an expert on this library, so there may be further gains to be had from better tuning. But on the surface, we're already getting a good bump on both speed and size.