3 ms·
Are you sure about no JSON? My experience is JSON is fairly small, and faster than anything else because it has browser support.
by CJefferson 9y ago
Are you sure about no JSON? My experience is JSON is fairly small, and faster than anything else because it has browser support.
- synthmeat 9y agoFor my use case, replacing JSON with custom binary protocol, some old version being here [1], had savings of about 2 orders of magnitude in bandwidth and at least 1 order of magnitude improvements in server CPU usage. Some significant memory savings too. There's also space for more optimizations to be done, but I consider it viable enough for now. ArrayBuffer and DataView are fairly fast for my standards. [1] https://gist.github.com/synthmeat/d23595db732d366f658a1981e92429b1 https://gist.github.com/synthmeat/d23595db732d366f658a1981e9...
- deleted 9y ago[deleted]
- nullpilot 9y agoNot OP but yes, absolutely. JSON and MsgPack are schemaless, which means they put the schema, including object keys etc on the wire. On every transfer. The problem is less the client, you're right with that. The problem is that server bandwidth and CPU scale up really quickly if you try to do 30fps, no matter what method you use to keep state in sync. If you want any significant amount of players in a realtime game, this will be one of your first bottlenecks, probably before any encoding and decoding. For less realtime-y games, JSON and also socket.io can be perfectly adequate. Protobuf is just insanely slow to encode/decode client side. So that's out too if you want fast paced games. And for slower games it is not worth the effort.
- garkin 9y agoIt's not for client. It's for server and bandwidth.