A side topic to #196:
@jteresco noted that many of our graphs will have lots of segments with very few travelers, meaning many 0 digits, and floated the idea of saving space in traveled graph files.
#196 (comment)
I considered run-length encoding of 0s, ultimately dropping the idea on simplicity grounds.
#196 (comment)
An idea that will help out in subgraphs is to only record travelers who've clinched at least one segment contained in the graph. For example:
- in TX, right now there are only 129 travelers, meaning we can use 33 characters per
clinchedby_code, instead of 60. - in PE, right now there are only 17 travelers, meaning we can use 5 characters per
clinchedby_code, instead of 60.
Advantages:
Requires no changes to the TMG 2.0 traveled"specification", keeping the hex clinchedby_code encoded simply & intuitively.
Limitations:
The more travelers we have in a dataset, the smaller the savings, all the way up to tm-master-traveled.tmg, with no savings at all (assuming each traveler has at least one segment traveled).
Disadvantages:
Using the full traveler list for all graphs, we can potentially save time (how much?) by generating clinchedby_codes during graph setup, and looking them up, instead of regenerating, for all subgraphs.
With subgraphs using different traveler lists and thus different clinchedby_codes for each segment, this is no longer an option.
Implementation:
We'd have to reassign traveler numbers for each graph.
- Python, with graphs generated one at a time, is no big deal. Just reuse
TravelerList.traveler_num. - C++, with multi-threaded subgraph generation, is more complicated.
- Either create a
TravelerList->traveler_num hash table for each graph, or - Better yet (faster/less complicated), store
TravelerList::traveler_num as an array of numthreads elements, and reassign for each graph.
A side topic to #196:
@jteresco noted that many of our graphs will have lots of segments with very few travelers, meaning many
0digits, and floated the idea of saving space in traveled graph files.#196 (comment)
I considered run-length encoding of
0s, ultimately dropping the idea on simplicity grounds.#196 (comment)
An idea that will help out in subgraphs is to only record travelers who've clinched at least one segment contained in the graph. For example:
clinchedby_code, instead of 60.clinchedby_code, instead of 60.Advantages:
Requires no changes to the
TMG 2.0 traveled"specification", keeping the hexclinchedby_codeencoded simply & intuitively.Limitations:
The more travelers we have in a dataset, the smaller the savings, all the way up to tm-master-traveled.tmg, with no savings at all (assuming each traveler has at least one segment traveled).
Disadvantages:
Using the full traveler list for all graphs, we can potentially save time (how much?) by generating
clinchedby_codes during graph setup, and looking them up, instead of regenerating, for all subgraphs.With subgraphs using different traveler lists and thus different
clinchedby_codes for each segment, this is no longer an option.Implementation:
We'd have to reassign traveler numbers for each graph.
TravelerList.traveler_num.TravelerList->traveler_numhash table for each graph, orTravelerList::traveler_numas an array ofnumthreadselements, and reassign for each graph.