yakra / tmtools

Tools to aid in development of the TravelMapping project
0 stars 0 forks source link

canvas: color lookup #36

Closed yakra closed 6 years ago

yakra commented 6 years ago

Right now, systems.csv is crawled for every WPT. Systems.csv is 16K. That's comparable to the size of the largest WPT in usany. The average WPT size might be about 1.2K. Do this for 1100 routes and it can add up. Indeed, the latest revision of canvas is about 1/2 the speed of "canvas2017".

What to do: • ~Read colors.ini once~, and ~create 3 vectors: \<string> N_Colors; <char[7]> UnColors, ClColors; These can be stored in envV.~ No real need to make another larger object to contain them. • Read systems.csv once, • Skip commented CSV lines (mind DOS/UNIX), and • Create a deque of system objects. • Store UnColor & ClColor for each system object, looking up at the time of its creation. That way, the N_Colors vector (even if it is fairly small) only has to be searched once per system, instead of once per route.

Why vectors for colors? • Colors are read after commandline options, due to needing an INI filename. Anything individually specified via commandline will already be at the front of the vector.

Why deques for tmsystem objects? • Hard-coding _boundaries as Tier 6 is a Bad Idea. Should be MaxTier+1. • For that number to be known, _boundaries must be added after systems.csv is read. • push_front makes sense, to keep _boundaries at the beginning for optimal searching.