Kids! You should have sex!! It's faster!
Wha?
No no!
Don't go sue me now hehe ;)
What I meanth to say was;
Kids, you should have SEX, or atleast imitate SEX, for
it is faster in interpreting.
The way I interpret a program is an example to all
yall interpretter coders.
David could have his PY run 10 times faster than
Euphoria if he adopted my interpretation style.
The way I do it, the Translator optimises code
execution with athe speed of light.
See, this is all I do to run a program with my
interpreter;
while 1 do
call_proc(code[idx],{code[idx+1],code[idx+2]})
idx+=3
end while
call_proc() calls a virtual machine code in the 'code'
sequence, wich has the following form;
{ROUT_ID,arg1,arg2,ROUT_ID,arg1,arg2, ... }
It calls all ROUT_IDs, wich are routine IDs to
procedure like the following;
procedure add(integer a, object b)
memory[a] += b
end procedure
This is *exactly* the same way EX.EXE interprets your
programs.
Since this is 'threaded code'.
It's got less (memory) overhead than EX.EXE, since
EX.EXE does this;
procedure add(integer a, object b)
memory[a] += b
idx+=3;
end procedure
Since that's the only way to do it in C.
Only, when translated to C, your Eu version will run
FASTER than EX.EXE (10 to 12 times) because you don't
do any run-time checks on each operation.
Something coders who implement interpreters, wich
don't know Jack Shit nor John Diddly Squat about
interpreter design, is do the following;
sequence code
code = {}
constant ADD = 1,
DIV = 2,
MUL = 3,
SUB = 4,
CALL = 5
code = {ADD,10,1,DIV,1,3,MUL,5,4}
for i = 1 to length(code) by 3 do
if code[i] = ADD then
memory[i+1] += memory[i+2]
elsif code[i] = DIV then
memory[i+1] /= memory[i+2]
elsif code[i] = MUL then
memory[i+1] *= memory[i+2]
elsif code[i] = sub then
memory[i+1] -= memory[i+2]
end if
end for
Above is extremely slow.
Especially in Euphoria.
In C you'd use 'switch' to do the evaluations.
My implementation executes a stream of 32-Bit codes on
the fly without using a switch statement.
I'm telling you, IT'S FAST!
Infact, interpretation speeds are 80 times faster than
JAVA. (!!!)
Try it out for your code, I think you'll be surprised.
Mike The Spike
|
Not Categorized, Please Help
|
|