Skip to content

Optimize the view algorithm#2565

Merged
wixoaGit merged 1 commit into
OpenDreamProject:masterfrom
wixoaGit:optimize_view
May 14, 2026
Merged

Optimize the view algorithm#2565
wixoaGit merged 1 commit into
OpenDreamProject:masterfrom
wixoaGit:optimize_view

Conversation

@wixoaGit
Copy link
Copy Markdown
Member

@wixoaGit wixoaGit commented May 13, 2026

The view algorithm would loop over every tile in range several times, more times the larger the range was. It only updated each tile during one of the iterations and ignored them during the others though. The pattern they get updated in is easily predictable, so each tile only gets iterated on twice now (once in step 3, once in step 4).

This code in TestGame went from 6.8 seconds to 0.9 seconds (map size 1000x1000x1):
world.log << view(500, locate(500,500,1)):len

@boring-cyborg boring-cyborg Bot added Client Involves the OpenDream client Runtime Involves the OpenDream server/runtime labels May 13, 2026
@wixoaGit wixoaGit merged commit 44dfb39 into OpenDreamProject:master May 14, 2026
20 checks passed
@wixoaGit wixoaGit deleted the optimize_view branch May 14, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Client Involves the OpenDream client Runtime Involves the OpenDream server/runtime size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant