Optimize GroupsInOrder.

GroupsInOrder is an extremely hot function, especially during object
picking: before this commit, it was easy to get second plus latencies
on picking, and after this commit picking is almost real-time.
pull/109/head
EvilSpirit 2016-11-10 21:55:00 +07:00 committed by whitequark
parent 13d4a1bb6a
commit a0d7f1dadb
1 changed files with 3 additions and 3 deletions

View File

@ -59,9 +59,9 @@ bool SolveSpaceUI::GroupsInOrder(hGroup before, hGroup after) {
int beforep = -1, afterp = -1;
int i;
for(i = 0; i < SK.groupOrder.n; i++) {
Group *g = SK.GetGroup(SK.groupOrder.elem[i]);
if(g->h.v == before.v) beforep = i;
if(g->h.v == after.v) afterp = i;
hGroup hg = SK.groupOrder.elem[i];
if(hg.v == before.v) beforep = i;
if(hg.v == after.v) afterp = i;
}
if(beforep < 0 || afterp < 0) return false;
if(beforep >= afterp) return false;