Skip to content
This repository was archived by the owner on Aug 20, 2020. It is now read-only.
This repository was archived by the owner on Aug 20, 2020. It is now read-only.

Convert globalstep + timer into minetest.after #179

@ElementW

Description

@ElementW

Some mods implement their tick logic using globalstep callbacks and a timer variable. This is heavy because the Lua VM must execute every callback for each server step, however if there is a timer (generally 1s) most of the time no actual code gets executed, just the timer variable {in,de}cremented.
Replacing this technique by minetest.after would reduce code duplication as well as increase performance since all the timers this function creates are handled by the same loop (in builtin/game/misc.lua#9), reducing the need to do context switches (locals) and allowing LuaJIT to streamline timer ticking to the maximum possible extent, thus increasing performance.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions