Closed TurkeyMcMac closed 2 years ago
Whenever any pending after callback runs, all the others must be checked.
What do you mean by that? minetest.after
went through several optimization steps already. The overhead compared to the globalstep method is pretty much negligible due to low simultaneous job count and efficient queue processing.
The code for minetest.after
records time_next
when the job list should next be checked. However, it does not record which one should be checked. So when time_next
is up, all the pending jobs are checked for expiration.
Probably not worth it.
This is an improvement to my previous pull request. The main advantage of using globalstep is that the cost of ccompass shows up in the profiler. In singleplayer when no one is using a compass, the average cost per step is only about 10 microseconds. One problem with the
minetest.after
solution is its interaction with other users ofminetest.after
. Whenever any pendingafter
callback runs, all the others must be checked. This could scale poorly. The globalstep solution is more predictable.