Minor optimization to hot minimap procs - #12747
Open
fira wants to merge 3 commits into
Open
Conversation
boskoramen
reviewed
Jul 27, 2026
| if(isturf(source.loc)) | ||
| pixel_x = MINIMAP_PIXEL_FROM_WORLD(source.x) + SSminimaps.minimaps_by_z["[source.z]"].x_offset | ||
| pixel_y = MINIMAP_PIXEL_FROM_WORLD(source.y) + SSminimaps.minimaps_by_z["[source.z]"].y_offset | ||
| if(source.z) |
Contributor
There was a problem hiding this comment.
this is a neat way to check if an atom is on a turf, might be worth exporting this check to a helper define
boskoramen
approved these changes
Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
About the pull request
Minor optimization to
/image/proc/minimap_on_moveThe proc is both hot and extremely costly for some reason.
During recent 200-pop round it hit about 82,000 ms over 510,000 calls.
The only real highlight is it reuses the result of minimap lookup instead of doing it twice, because I don't see what else could be expensive here unless it's literally setting pixel_x/y.
--
Same treatment for
/datum/controller/subsystem/minimaps/proc/remove_markerwhich is vastly less expensive, but still expensive