File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 1414 var p2 = new Thread ( [ 1000 , 2000 , 3000 ] ) ;
1515
1616 var start = Date . now ( ) ;
17- var start2 = Date . now ( ) ;
18-
1917 var time = null ;
20- var time2 = null ;
2118
2219 runs ( function ( ) {
2320 p . spawn ( function ( data ) {
3229 time = Date . now ( ) - start ;
3330 result = data ;
3431 } ) ;
32+ } ) ;
33+
34+ waitsFor ( function ( ) {
35+ return time != null ;
36+ } , "Sequential should finish" , 5000 ) ;
3537
38+ var start2 = Date . now ( ) ;
39+ var time2 = null ;
40+
41+ runs ( function ( ) {
3642 p2 . map ( slowSquare ) . then ( function ( data ) {
3743 time2 = Date . now ( ) - start2 ;
3844 result = data ;
3945 } ) ;
4046 } ) ;
4147
4248 waitsFor ( function ( ) {
43- return time != null && time2 != null ;
44- } , "it should finish" , 5000 ) ;
49+ return time2 != null ;
50+ } , "Parallel should finish" , 5000 ) ;
4551
4652 runs ( function ( ) {
4753 expect ( time2 ) . toBeLessThan ( time / cpus ) ;
You can’t perform that action at this time.
0 commit comments