I'd like to store objects using their coordinates, like so:
var hash_map = {};
hash_map[x + "-" + y] = new Object();
These can then be retrieved using hash_map[x + "-" + y].
However, I am not sure about whether creating a new string every time an object is accessed is such a great idea.
An alternative would be to combine the coordinates by doing something like x | (y >>> 16) but I have no idea about how many bits to shift the y value by, what actually happens internally (since javascript's numbers are all floats, so there's an exponent and mantissa etc) and whether it's actually worth it.
tl;dr What's the fastest way (including garbage collection) of storing objects in a hash map with coordinates as keys?