Skip to content

Commit 85ec63f

Browse files
authored
Merge pull request #16 from oxygens/master
Small things.
2 parents ee4ff16 + cebef4d commit 85ec63f

File tree

8 files changed

+30
-32
lines changed

8 files changed

+30
-32
lines changed

README.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ See `JSONRPC.ClientPluginBase` and `JSONRPC.ServerPluginBase`. Plugins may be ad
4141

4242
Events may be used instead of plugins. Method names in `JSONRPC.ClientPluginBase` and `JSONRPC.ServerPluginBase` are also event names (event handlers have the same params) while `JSONRPC.Server` and `JSONRPC.Client` emit these events.
4343

44-
Events may be more efficient than plugins, if very small performance gains matter. Plugins on the other hand help write readable and maintanable code (and are asynchronous).
44+
Events may be more efficient than plugins, if very small performance gains matter. Plugins on the other hand help write readable and maintainable code (and are asynchronous).
4545

4646

4747
## Define an endpoint

bug.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"version": "3.2.3",
55
"scripts": {
66
"build": "node build.js",
7-
"test": "node --expose-gc --max-old-space-size=3072 tests/main.js",
8-
"benchmark": "node --expose-gc --max-old-space-size=3072 tests/benchmark.js",
7+
"test": "node --expose-gc --max-old-space-size=1024 tests/main.js",
8+
"benchmark": "node --expose-gc --max-old-space-size=1024 tests/benchmark.js",
99
"lint": "eslint src tests --quiet"
1010
},
1111
"repository": {

tests/AllTests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ class AllTests
11691169
{
11701170
return Math.round(Math.random() * (arrMethods.length - 1));
11711171
}
1172-
}
1172+
};
11731173

11741174
for(let i = 0; i < nCallCount; i++)
11751175
{

tests/benchmark.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ process.on(
3131
// uws is consistently slower than ws when benchmarking with a few open connections (2) with the same number of calls.
3232
// Most of the randomness was disabled when tested.
3333
// Tested on nodejs 7.8.0, Windows 10, 64 bit.
34+
// https://github.com/uWebSockets/uWebSockets/issues/585
3435
console.log("===== uws (20,000 calls in parallel, over as many reused connections as possible)");
3536
allTests = new AllTests(bBenchmarkMode, /*bWebSocketMode*/ true, require("uws"), require("uws").Server, JSONRPC.WebSocketAdapters.uws.WebSocketWrapper, /*bDisableVeryLargePacket*/ true);
3637
allTests.websocketServerPort = allTests.httpServerPort + 1;
@@ -40,6 +41,24 @@ process.on(
4041
console.log("");
4142

4243

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+
4362
console.log("===== ws (20,000 calls in parallel, over as many reused connections as possible)");
4463
allTests = new AllTests(bBenchmarkMode, /*bWebSocketMode*/ true, require("ws"), require("ws").Server, undefined, /*bDisableVeryLargePacket*/ true);
4564
await allTests.runTests();

tests/bug_uws_close_await_hang.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ process.on(
1111
}
1212
);
1313

14+
// https://github.com/uWebSockets/uWebSockets/issues/586
15+
1416
(
1517
async () =>
1618
{

tests/bug_uws_send_large_string_connection_closed.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ process.on(
1111
}
1212
);
1313

14+
15+
// https://github.com/uWebSockets/uWebSockets/issues/583
16+
1417
(
1518
async () =>
1619
{

tests/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ process.on(
1919
let allTests = new AllTests(bBenchmarkMode, /*bWebSocketMode*/ false);
2020
await allTests.runTests();
2121

22+
// uws "Segmentation fault" on .close() in Travis.
23+
// https://github.com/uWebSockets/uWebSockets/issues/583
2224
//allTests = new AllTests(bBenchmarkMode, /*bWebSocketMode*/ true, require("uws"), require("uws").Server, JSONRPC.WebSocketAdapters.uws.WebSocketWrapper, /*bDisableVeryLargePacket*/ true);
2325
//allTests.websocketServerPort = allTests.httpServerPort + 1;
2426
//await allTests.runTests();

0 commit comments

Comments
 (0)