File tree Expand file tree Collapse file tree 3 files changed +70
-0
lines changed Expand file tree Collapse file tree 3 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 1+ import 'regenerator-runtime/runtime.js' ;
2+ import { ArgumentParser } from 'argparse' ;
3+ import { range } from '@iterable-iterator/range' ;
4+ import { FAST_COUNTER as COUNTER } from '../test/src/_fixtures.js' ;
5+ import { empty } from './dist/profile/index.js' ;
6+
7+ console . time ( 'prepare' ) ;
8+
9+ const parser = new ArgumentParser ( ) ;
10+ parser . add_argument ( 'M' , { default : 1000 , nargs : '?' } ) ;
11+ parser . add_argument ( '-N' , { default : 1000 } ) ;
12+ const args = parser . parse_args ( ) ;
13+ const M = args . M ;
14+ const N = args . N ;
15+
16+ console . log ( 'number of operations:' , M * N ) ;
17+
18+ const t = empty ( COUNTER ) ;
19+ console . timeEnd ( 'prepare' ) ;
20+
21+ const r = range ( M ) ;
22+ console . time ( 'append+measure' ) ;
23+ for ( let k = 0 ; k < N ; ++ k ) t . append ( r ) . measure ( ) ;
24+ console . timeEnd ( 'append+measure' ) ;
Original file line number Diff line number Diff line change 1+ import 'regenerator-runtime/runtime.js' ;
2+ import { ArgumentParser } from 'argparse' ;
3+ import { range } from '@iterable-iterator/range' ;
4+ import { FAST_COUNTER as COUNTER } from '../test/src/_fixtures.js' ;
5+ import { from } from './dist/profile/index.js' ;
6+
7+ console . time ( 'prepare' ) ;
8+
9+ const parser = new ArgumentParser ( ) ;
10+ parser . add_argument ( 'M' , { default : 1000 , nargs : '?' } ) ;
11+ parser . add_argument ( '-N' , { default : 1000 } ) ;
12+ const args = parser . parse_args ( ) ;
13+ const M = args . M ;
14+ const N = args . N ;
15+
16+ console . log ( 'number of operations:' , M * N ) ;
17+
18+ console . timeEnd ( 'prepare' ) ;
19+
20+ const r = range ( M ) ;
21+ console . time ( 'from+measure' ) ;
22+ for ( let k = 0 ; k < N ; ++ k ) from ( COUNTER , r ) . measure ( ) ;
23+ console . timeEnd ( 'from+measure' ) ;
Original file line number Diff line number Diff line change 1+ import 'regenerator-runtime/runtime.js' ;
2+ import { ArgumentParser } from 'argparse' ;
3+ import { range } from '@iterable-iterator/range' ;
4+ import { FAST_COUNTER as COUNTER } from '../test/src/_fixtures.js' ;
5+ import { from } from './dist/profile/index.js' ;
6+
7+ console . time ( 'prepare' ) ;
8+
9+ const parser = new ArgumentParser ( ) ;
10+ parser . add_argument ( 'M' , { default : 1000 , nargs : '?' } ) ;
11+ parser . add_argument ( '-N' , { default : 1000 } ) ;
12+ const args = parser . parse_args ( ) ;
13+ const M = args . M ;
14+ const N = args . N ;
15+
16+ console . log ( 'number of operations:' , M * N ) ;
17+
18+ console . timeEnd ( 'prepare' ) ;
19+
20+ const r = range ( M ) ;
21+ console . time ( 'from' ) ;
22+ for ( let k = 0 ; k < N ; ++ k ) from ( COUNTER , r ) ;
23+ console . timeEnd ( 'from' ) ;
You can’t perform that action at this time.
0 commit comments