1 | /* fast-async test file - it gets compiled by Babel using fast-async and other async-await implementations to measure performance */
|
2 |
|
3 | function pause() {
|
4 | return new Promise(function ($return, $error) {
|
5 | setTimeout(function () {
|
6 | return $return(0);
|
7 | }, 0);
|
8 | });
|
9 | }
|
10 |
|
11 | async function doNothing() {
|
12 | return;
|
13 | }
|
14 |
|
15 | async function test() {
|
16 | var t = Date.now();
|
17 | for (var j = 0; j < 500; j++) {
|
18 | for (var i = 0; i < 500; i++) {
|
19 | await doNothing();
|
20 | }
|
21 | await pause();
|
22 | }
|
23 | return "Finished "+(500*500)+" async/awaits in "+(Date.now() - t)+"ms";
|
24 | }
|
25 |
|
26 | test().then(resolve,reject) ;
|
27 |
|
28 | /* If you see this, then test-input.js was compiled by babel-cli. Things to check are that there's an import at the top for nodent-runtime, and lots of symbols starting with $ */
|