Skip to content
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

vertex numbers #255

Open
2 of 11 tasks
Tracked by #270
yakra opened this issue Jul 16, 2023 · 0 comments
Open
2 of 11 tasks
Tracked by #270

vertex numbers #255

yakra opened this issue Jul 16, 2023 · 0 comments

Comments

@yakra
Copy link
Owner

yakra commented Jul 16, 2023

Carving out this side topic in order to close #217. Some background/notes there.

A few different v7 & v8 flavors are on BiggaTomato in branches:
v7gs 5849d90
v8 d8da55e
Refamiliarize.


Another possible v7 variant...

// simple, collapsed & traveled vertex numbers, per thread
int& HighwayGraph::s_vertex_num(HGVertex const* v, const int threadnum)
{	return vnums[(threadnum*vertices.size()+v-vertices.data())*3];
}
int& HighwayGraph::c_vertex_num(HGVertex const* v, const int threadnum)
{	return vnums[(threadnum*vertices.size()+v-vertices.data())*3+1];
}
int& HighwayGraph::t_vertex_num(HGVertex const* v, const int threadnum)
{	return vnums[(threadnum*vertices.size()+v-vertices.data())*3+2];
}

That's a hell of a lot of arithmetic to get our array indices.

  • Convert vnums to a static thread_local HGVertex member.
    This gets rid of threadnum*vertices.size()+, size() itself being calculated via begin()-end().
  • Save an index to the first pointer: unsigned int vnum = HGVertex::vnums+(v-vertices.data())*3;
  • Get our refs via vnum[0], vnum[1] & vnum[2].

Like I said in #217 (comment)

Hold off until more optimizations are in place and any changes may be more easily observed.

TMBitset is implemented, but there's more that can be done:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant