Page 1 of 1

MapCollisions()

Posted: Sat Jan 29, 2011 11:41 pm
by netmaestro
Or, possibly MapSize( map() [,flags] ) where flags could equal #PB_Map_Collisions. Or, as it's mainly useful at design time, it could just be incorporated into the Map Viewer in the Debugger with no command needed.

When using maps it would be useful to know how many collisions exist in the map data. Retrieving map elements that are part of a collision is much slower than for elements that generated a unique hash, and so maps with a high number of collisions should be made larger while those with few or no collisions could be made smaller to conserve memory. If the Purebasic Map library could track when a collision is created and keep a count somewhere that could be retrieved, this would aid the programmer greatly in tuning mapsize to achieve optimum speed while minimizing memory usage.