LeDark Lua, on 08 August 2015 - 03:18 PM, said:
It depends on the VM like java is make in some language and lua is made in java soo there is a delay and the lua depends on java which depends on the lsnguage java is made in.
The Java VM that your computer will use JITs the Java bytecode. This means it gets translated into machine code - what your CPU actually runs. Whilst Java is still slower than writing in machine code, the overhead is still significantly smaller than you make out.
The Lua VM however is interpreted. I've experimented with compiling to Java bytcode (which then gets converted to machine code) and it works mostly,
have a read about performance differences but in the end it only amounts to about 2-5x performance increase.
However, despite Lua is massively slower than machine code, it isn't as slow as 20Hz (20 instructions per second). You are probably getting confused with the Minecraft update speed - which is 20Hz. Some actions - such as sleep(0) and some peripheral calls are 'synchronised' with the server tick - and so stop your code running until the next server tick.
TLDR Use loops, this 20fps stuff is nonsense.
Edited by SquidDev, 08 August 2015 - 03:40 PM.