Hey guys,
I'm not posting this on Github because it's not really an issue. But, I did notice something when testing Websocket data. This was all done on the Normal v0.14.2 build (No Dev Tools open).
But basically, if you start sending a lot of text frames, for example, something like this:
createo = {};
for (var i = 0; i < 515; i++) {
createo[i] = {
"a": 31,
"b": i,
"c": "SWRC9",
"d": "12312213",
"e": [1, 2, 3, 4, 5],
"f": {},
"zz": 1461228009383,
"g": 0,
"h": 9300
}
}
var string = JSON.stringify(createo);
socket.send(string);
If you set this up as an Interval (for example,
every 100ms) your MEMORY usage for NW.js will go up drastically. My client went up to around 200,000 K in just under 3 minutes. (And the Garbage Collector did not kick in yet) -- This is because I believe Websockets do something with
utf-8 and they convert the buffer into
utf-8 every request; and it fills up the garbage collector faster.
And use a similar code block:
createo = {};
for (var i = 0; i < 515; i++) {
createo[i] = {
"a": 31,
"b": i,
"c": "SWRC9",
"d": "12312213",
"e": [1, 2, 3, 4, 5],
"f": {},
"zz": 1461228009383,
"g": 0,
"h": 9300
}
}
var buffer = msgpack.encode(createo);
socket.send(buffer);
NW.js actually stays at roughly 75,000 K in memory. And continues to idle around there and this is even when sending the data at every 100ms.
I have tried BSON, PSON, msgpack, msgpack5, UBSON, etc. None of them are as fast as msgpack-lite.
In any event, my point is: use Binary Websockets!!
And, thanks to Roger for such a great program, keep it up!