Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

Remove uniform submap branching

Open prharvey opened this issue 2 years ago • 5 comments

Summary

Performance "Remove branching in submap accessors."

Purpose of change

See issue #70399

Describe the solution

Make uniform submaps point to a shared pre-filled submap, instead of having it be a special case. I'm not expecting any large performance changes from this alone, it's just easy to deliver in a PR separate from other tasks.

Describe alternatives you've considered

I did not change the get_items/get_fields non-const accessors since their behavior is somewhat odd, and has the potential to break things. They should be revisited (and removed) in a future PR.

Testing

All tests pass.

Additional context

prharvey avatar Dec 25 '23 18:12 prharvey

Going to leave this sitting until everything else in that issue is done, since I'm not yet completely convinced it's worth the added complexity.

prharvey avatar Dec 27 '23 08:12 prharvey

How much memory does this end up using? maptile_soa is not small, iirc.

akrieger avatar Jan 08 '24 17:01 akrieger

How much memory does this end up using? maptile_soa is not small, iirc.

IIRC, when I looked it was essentially the cost of 4 additional submaps (air, rock, soil, and one other). Given the reality bubble is ~2.5k submaps, it shouldn't matter.

prharvey avatar Jan 09 '24 07:01 prharvey

Uniform initialization is a nontrivial amount of time in memset as well during load. I will play with this and might ask to undraft this anyway.

Edit: eh, can't seem to pick it up anymore. Maybe other fixes when in which mitigated it (maybe it was happening too often before).

akrieger avatar Jan 13 '24 01:01 akrieger

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

github-actions[bot] avatar Feb 20 '24 15:02 github-actions[bot]