]> git.cworth.org Git - lmno-server/commitdiff
game: Index players directly by session ID
authorCarl Worth <cworth@cworth.org>
Fri, 5 Jun 2020 13:57:04 +0000 (06:57 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 5 Jun 2020 14:46:37 +0000 (07:46 -0700)
Previously we were just storing the players in an unordered array, and
doing an O(n) walk through the array to find a player with a session
ID that matched the ID of interest.

Instead, we now index directly with the session ID which is already
guaranteed yo be unique and is convenient in JavaScript where we can
use the session ID as a property name, and even use a convenient
subscript syntax for that.

With this change we don't even need to store the session_id property
on the player since it is now not used at all.


No differences found