-
Notifications
You must be signed in to change notification settings - Fork 6
TMBitsets for subgraph membership, etc #622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
...to be implemented 4 commits in the future.
to defragment TMBitsets & reduce heap footprint by a factor of: ~10.4 for regions ~3.52 for systems
should have happened as part of a1d59f8
Setting up for graphs of highway dataStarting at the start of graph generation....
|
Creating vertices and region & system vertex (and edge) sets
However, this missing functionality has just been moved elsewhere.
Now let's rewind a bit for a fun little curiosity of vertex-only sets.
|
Edge construction
Back at the HighwayGraph ctor, the collapse condition (whether to do 1 dual-format collapse or 2 independent single-format collapses) is much simpler (yakra#269, yakra#95). |
Writing graph filesAnd now, the good stuff!
|
Reading subgraph descriptionsSaving this for last (well, out of the graph-related charts anyway) because it's the least. :)
A few oddities & observations about the machines' relative performance:
|
Ready to rock! |
Wow, this all looks great as usual. Looks like you want me to try it out on my Mac. Just see if it compiles OK, or do you want me to run some tests? |
It compiles, it runs datacheck. 7.2 seconds before, 5.5 seconds after. I'll merge and use in the next site update. |
This is on the production Thanks again! |
Thanks for merge & testing! Just a compile was all I was worried about; good to see that works.
That's got to all be in reading .wpt files, with the data all cached on the 2nd run. ;) Next pull request will affect --errorcheck, speeding up userlogs. |
Sure enough - both are about 5.5 second on second and third runs once things are cached. |
I run data check (/fast/tm) yesterday just after you wrote that. It took 12 seconds. I run it again now, and it was 14 seconds on first run and 12s on 2nd to 4th run. I wonder if it was already in place on /fast/tm when I run it yesterday? |
^ I think the 5.5s figure is for Jim's M1 Mac rather than noreaster. No surprise for railways; much smaller dataset! 😀 |
@jteresco, I'd recommend to be absolutely safe, downloading & doing a MacOS/XCode compile (warnings notwithstanding) before merging this, due to using a few clang builtins.
What's this about?
Taking care of a couple errorcheck items (#614, #621) along the way, the main focus here is implementing some long-planned speed improvements for graph generation.
A couple extra steps in the HighwayGraph ctor populate sets of vertex & edge pointers for each region & system in a subgraph.
When writing the subgraphs, we quickly populate vertex & edge sets via the magic of
|=
and (for fullcustom graphs)&=
.No more of this clunky iterating through vectors, chasing pointers around, checking membership with ad-hoc bitmasks, and populating more vectors.
Edges in particular benefit. There used to be 3 lists of incident edges for each vertex and 3 vectors of matching edges for each subgraph. Simple, collapsed, traveled. Now, there's 1 vector and 1 TMBitset.
No more redundantly checking an edge for membership 2, 4 or 6 times. It's just there in the TMBitset.
(The redundancy is limited to 2 checks, one for each vertex, back in the ctor when the region/system sets are populated.)
From here, we iterate 1 container, not 3, and write each edge's info to the simple, collapsed, or traveled files per its
format
bits.HGVertex & HGedge objects are more lightweight, and they mey get smaller in the future too.
What does it not do?
This doesn't reach the goal of getting FreeBSD to scale gracefully to more threads (next pull request) but still yields a significant additional improvement.
Nota Bene:
In d218c4d, Region::ve_thread introduces some diffs to graphs, omitting 5 points in 4 graphs in 3 regions.
TLDR: When a location at a border contains only devel points in Region A and active/preview points only in Region B:
• Before: The vertex is included in A's region graph, and any 2+region graphs that include Region A but not B.
• After: The vertex is omitted from these graphs.
More details, including a list of the affected points & graphs, at yakra#265 (comment).
I believe this is The Right Thing To Do.
Misc. facts:
Later, some last-minute optimizations removed the need to do this, so I reverted those commits, allowing us to continue to build siteupdate using older toolchains.
This pull request introduces 7 more:
niram
has only one edge in the entire system.new
objects on the heap & come up with clever ways to track & delete them if I can just emplace them in a temporary container like astd::list
which goes out of scope at the end of the HighwayGraph ctor. I ultimately decided to do away with the temporary container and moves entirely, and just store all the edges, including the "dead" ones, in a TMArray. The cost of copying all the edges & then destroying the temporary container outweighed the benefit of keeping the HGEdge TMBitsets absolutely minimized and free of extraneous 0s. TMBitset iteration is pretty efficient now, and the extra 0s don't hurt much.Skipping the sorting optimizes for speed though not RAM use, and leaves open the possibility of finding clever ways to reorder edge construction in the future.