@@ -17,27 +17,38 @@ process.on(
1717 const bBenchmarkMode = true ;
1818
1919
20- console . log ( "===== http (500 calls in parallel)" ) ;
21- let allTests = new AllTests ( bBenchmarkMode , /*bWebSocketMode*/ false , undefined , undefined , undefined , /*bDisableVeryLargePacket*/ true ) ;
22- await allTests . runTests ( ) ;
23-
24- console . log ( "===== ws (20,000 calls in parallel, over as many reused connections as possible)" ) ;
25- allTests = new AllTests ( bBenchmarkMode , /*bWebSocketMode*/ true , require ( "ws" ) , require ( "ws" ) . Server , undefined , /*bDisableVeryLargePacket*/ true ) ;
26- await allTests . runTests ( ) ;
27-
28- // Super bug: somehow V8 is deoptimized here (win 10, 64 bit).
29- // Running ws first will show ws is faster. Running uws first, will show uws is faster.
30-
31- console . log ( "===== uws (20,000 calls in parallel, over as many reused connections as possible)" ) ;
32- allTests = new AllTests ( bBenchmarkMode , /*bWebSocketMode*/ true , require ( "uws" ) , require ( "uws" ) . Server , JSONRPC . WebSocketAdapters . uws . WebSocketWrapper , /*bDisableVeryLargePacket*/ true ) ;
33- allTests . websocketServerPort = allTests . httpServerPort + 1 ;
34- await allTests . runTests ( ) ;
35-
36- // uws is consistently slower than ws when benchmarking with a few open connections (2) with the same number of calls.
37- // Most of the randomness was disabled when tested.
38- // Tested on nodejs 7.8.0, Windows 10, 64 bit.
39-
40- console . log ( "[" + process . pid + "] Finished all tests!!!" ) ;
20+ let nPasses = 5 ;
21+ let allTests ;
22+ while ( nPasses -- )
23+ {
24+ //console.log("===== http (500 calls in parallel)");
25+ //allTests = new AllTests(bBenchmarkMode, /*bWebSocketMode*/ false, undefined, undefined, undefined, /*bDisableVeryLargePacket*/ true);
26+ //await allTests.runTests();
27+ //global.gc();
28+ //console.log("heapTotal after gc(): " + Math.round(process.memoryUsage().heapTotal / 1024 / 1024, 2) + " MB");
29+ //console.log("");
30+
31+ // uws is consistently slower than ws when benchmarking with a few open connections (2) with the same number of calls.
32+ // Most of the randomness was disabled when tested.
33+ // Tested on nodejs 7.8.0, Windows 10, 64 bit.
34+ console . log ( "===== uws (20,000 calls in parallel, over as many reused connections as possible)" ) ;
35+ allTests = new AllTests ( bBenchmarkMode , /*bWebSocketMode*/ true , require ( "uws" ) , require ( "uws" ) . Server , JSONRPC . WebSocketAdapters . uws . WebSocketWrapper , /*bDisableVeryLargePacket*/ true ) ;
36+ allTests . websocketServerPort = allTests . httpServerPort + 1 ;
37+ await allTests . runTests ( ) ;
38+ global . gc ( ) ;
39+ console . log ( "heapTotal after gc(): " + Math . round ( process . memoryUsage ( ) . heapTotal / 1024 / 1024 , 2 ) + " MB" ) ;
40+ console . log ( "" ) ;
41+
42+
43+ console . log ( "===== ws (20,000 calls in parallel, over as many reused connections as possible)" ) ;
44+ allTests = new AllTests ( bBenchmarkMode , /*bWebSocketMode*/ true , require ( "ws" ) , require ( "ws" ) . Server , undefined , /*bDisableVeryLargePacket*/ true ) ;
45+ await allTests . runTests ( ) ;
46+ global . gc ( ) ;
47+ console . log ( "heapTotal after gc(): " + Math . round ( process . memoryUsage ( ) . heapTotal / 1024 / 1024 , 2 ) + " MB" ) ;
48+ console . log ( "" ) ;
49+ }
50+
51+ console . log ( "[" + process . pid + "] Finished benchmarking." ) ;
4152
4253 process . exit ( 0 ) ;
4354 }
0 commit comments