Skip to content

Commit 1d84de9

Browse files
author
ionut.stan
committed
Added useless tests.
1 parent a17b2aa commit 1d84de9

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/benchmark.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ process.on(
3232
// Most of the randomness was disabled when tested.
3333
// Tested on nodejs 7.8.0, Windows 10, 64 bit.
3434
// https://github.com/uWebSockets/uWebSockets/issues/585
35-
// If replacing the uws client with ws and keeping the uws server, then uws wins at memory used by a large margin. Doesn't win the CPU though.
3635
console.log("===== uws (20,000 calls in parallel, over as many reused connections as possible)");
3736
allTests = new AllTests(bBenchmarkMode, /*bWebSocketMode*/ true, require("uws"), require("uws").Server, JSONRPC.WebSocketAdapters.uws.WebSocketWrapper, /*bDisableVeryLargePacket*/ true);
3837
allTests.websocketServerPort = allTests.httpServerPort + 1;
@@ -42,6 +41,24 @@ process.on(
4241
console.log("");
4342

4443

44+
console.log("===== uws.Server, ws.Client (20,000 calls in parallel, over as many reused connections as possible)");
45+
allTests = new AllTests(bBenchmarkMode, /*bWebSocketMode*/ true, require("ws"), require("uws").Server, JSONRPC.WebSocketAdapters.uws.WebSocketWrapper, /*bDisableVeryLargePacket*/ true);
46+
allTests.websocketServerPort = allTests.httpServerPort + 1;
47+
await allTests.runTests();
48+
global.gc();
49+
console.log("heapTotal after gc(): " + Math.round(process.memoryUsage().heapTotal / 1024 / 1024, 2) + " MB");
50+
console.log("");
51+
52+
53+
console.log("===== uw.Server, uws.Client (20,000 calls in parallel, over as many reused connections as possible)");
54+
allTests = new AllTests(bBenchmarkMode, /*bWebSocketMode*/ true, require("uws"), require("ws").Server, JSONRPC.WebSocketAdapters.uws.WebSocketWrapper, /*bDisableVeryLargePacket*/ true);
55+
allTests.websocketServerPort = allTests.httpServerPort + 1;
56+
await allTests.runTests();
57+
global.gc();
58+
console.log("heapTotal after gc(): " + Math.round(process.memoryUsage().heapTotal / 1024 / 1024, 2) + " MB");
59+
console.log("");
60+
61+
4562
console.log("===== ws (20,000 calls in parallel, over as many reused connections as possible)");
4663
allTests = new AllTests(bBenchmarkMode, /*bWebSocketMode*/ true, require("ws"), require("ws").Server, undefined, /*bDisableVeryLargePacket*/ true);
4764
await allTests.runTests();

0 commit comments

Comments
 (0)