minetest/minetest — pull request #1817 by gravgun (2014-11-09 09:34:12+00:00)
Title: Improved VoxelArea variable locality, thus performance

I remembered of some Lua optimization tips, including the speed penalty introduced by globals and table element fetching (including `self`), so optimized away VoxelArea because it is somewhat performance-critical code in Lua-based mapgens.

Here's a benchmark script I used to test if my changes did make a difference (only tests original and optimized `VoxelArea:getExtent()`): http://pastebin.com/SSm10Nh0, and here are my results:
```sh
$ lua vx.lua && luajit vx.lua
C LUA Time global: 0.87
C LUA Time local : 0.77
LuaJIT Time global: 0.41
LuaJIT Time local : 0.40
```
So on LuaJIT it makes little to no difference, and for builds without LuaJIT it *does* make a little improvement.