Change minetest.after() to a function that is called on next redstone tick for more speed (since minetest.after uses table.remove, which is much less efficient because we can handle all elements at once since it is the next globalstep and not more)