[renderer] Boost R_MarkLeaves very slightly

Using set iterators can be quite a lot faster for sparse sets due to the
function call overhead in testing each element. Times for ad_tears
dropped from about 1200us to about 670us (hard to say due to there being
only 3 data points and a lot of noise in the time).
This commit is contained in:
Bill Currie 2023-07-25 15:22:45 +09:00
parent 1f99f89a4a
commit f7fce957e8

View file

@ -77,7 +77,8 @@ R_MarkLeaves (visstate_t *visstate, const mleaf_t *viewleaf)
vis = Mod_LeafPVS (viewleaf, brush); vis = Mod_LeafPVS (viewleaf, brush);
} }
for (unsigned i = 0; i < brush->visleafs; i++) { for (auto li = set_first (vis); li; li = set_next (li)) {
unsigned i = li->element;
if (set_is_member (vis, i)) { if (set_is_member (vis, i)) {
leaf = &brush->leafs[i + 1]; leaf = &brush->leafs[i + 1];
if ((c = leaf->nummarksurfaces)) { if ((c = leaf->nummarksurfaces)) {