> -----Original Message----- > From: Jerome Vouillon [mailto:[EMAIL PROTECTED] > > The python interpreter seems rather slow. I get these numbers with the > Ocaml bytecode interpreter. > > mistral-jerome:/tmp > time python test.py > python test.py 2,59s user 0,00s system 100% cpu 2,582 total > mistral-jerome:/tmp > ocamlc -o tst test.ml; time ./tst > ./tst 0,14s user 0,00s system 106% cpu 0,131 total > mistral-jerome:/tmp > cat test.ml > let foo () = () in > for i = 1 to 1000000 do foo () done
That is impressive. I don't know Ocaml but do you think there is an optimization being done since foo takes no args, returns not values and has an empty body? Also I should have mentioned that python spends between one third and one half of its time executing the loop instructions (test and increment). Parrot is much faster at this of course. Parrot sub and method calls can be made faster or slower depending on how much of the context needs to be saved. I can imagine several types of continuations that differ on how much context they save and restore: a. only an opcode ptr to jump to b. opcode and the stacks c. opcode, stacks and half of the registers d. opcode, stacks and all of the registers The patch I sent supports two types: type b (in continuation.pmc) and type d (in completecontext.pmc). Also in this patch is the option to not create a new continuation --as in a tail call-- which of course makes it very fast. -- Jonathan Sillito