Hi,
Sometimes I return in my mind to more general solutions, like changing
compiler to generate expression tree instead of code, typed variables, etc.
The last nice source of ideas I found is Lua virtual machine. In Lua 5.0,
VM was rewritten from stack based machine to register-based machine. This
increased performance about 20%. Instead of:
PUSHLOCAL 1
PUSHLOCAL 2
ADD
POPLOCAL 3
they use:
ADD 3 1 2
yes but if you look carefully then you will find that number of registers
in such implementation is reduced to 256 what also reduce maximal number
of local variables which have to be less or equal (depending on code) to
the number of registers.
Yes, I know. I'm not talking about dropping current stack-based HVM, but
the usage of additional registry-based instructions can be a way of
optimisation. If local variable number exceeds 255, we can use
stack-based push/pop style. Addition "registers" can be allocated using
the same HB_P_FRAME.
Of cause, such mixture of stack-based and register-based commands is
redundant and may seem not a nice solution. So, I think it's worth to
implement it only if we gain a significant speed improvement.
all arrays are assocciative arrays and they have a good performance for it
also.
Internally they can use two different representations: hash and indexed
arrays. I do not remember your exact test code but I guess LUA detects
it's indexed array and do not use hash array for internal representation.
It's explained (just see Fugure 2, on page 7, on
http://www.tecgraf.puc-rio.br/~lhf/ftp/doc/jucs05.pdf). All Lua tables
have both array and hash parts. I do not thing it is worth to implement
this approach in Harbour hashes, since programmers chooses array or hash
to fit their need. But Lua's idea is nice in case all arrays are hashes.
Regards,
Mindaugas
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour