lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> Can you explain how much this experiment tells us?  You've added
> bytecodes, etc., so I'm not surprised it's slower. [...]

This is only a back of the envelope estimation. The original loop has 10 
opcodes, the new one has 13, so are not the opcodes that make the 
difference of more than 50% in run time. Also, my "global" table in the 
experiment has only one element; a real one would have some hundreds (at 
least 100 from predefined and library functions). (We need an average of 1.5 
probes to access such table). 

Of course there are many ways to improve its efficiency (implicit access to 
the global table in the opcode, special access method for strings, etc), 
but we will loose some performance at the end. As I said, we will
try a real implementation to get a better estimate.

(Another advantage of using a table for globals: you can change the whole
global environment with a simple assignment.)

-- Roberto