einaros/ws — Issue #26: for Server._clients, use map (Object) instead of Array for better efficiency
Author: ypocat
Created: 2012-02-22 19:17:06+00:00
State: open

https://github.com/einaros/ws/blob/459b3f6c46e9feea8ca84be12aacfeaa129707d6/lib/WebSocketServer.js#L78

https://gist.github.com/1886673#comments

Not a big deal for less than 10k clients I suppose, but would be nice to have:)

(At 100k objects, a put / delete op takes ~0.001 ms with map (Object), and ~0.1 ms with Array. At 10k objects, this difference is much smaller of course.)

The `WebSocket` client would need an `id` to be used as a key in the map, but this could be assigned from a static counter++.