Dan Sugalski wrote:
ftp://python.org/pub/python/parrotbench/parrotbench.tgz
It's pretty evil, and there's a chunk of "let's exercise python's builtins
just because" code in there.
Yep that's it, you can omit the word "pretty", though.
Worth taking a look at, as we may well enlist the aid of the list to get
some of those built-in functions working. (Which will be cool, since it'll
mean a push to get a chunk of extra, useful functionality in)
Yeah. A lot is needed for Perl too.
Below (attached inline I hope) are some notes WRT b6.py.
leo
I want to keep you informed, what's going on for the Pie-thon
contest. So I'll start a series of postings discussing the
main features (and problems, quirks, todos,...) of the individual
benchmark files.
I don't have the Python->PIR compiler or something similar yet,
so I'm currently just guessing, what might be needed to get that
code running. For more information on the benchmark just download
it, if you haven't done yet.
I'll start with the last benchmark, its the shortest one (except for
the benchmark driver, which just imports the other benchmarks and
prints a message. b.py (the driver) should work w/o problems.
b6.py features
Python code snippets # PIR code notes
------------------------------------------------------------------
from file(.py) import func # load_bytecode
# TODO global namspace aliasing
for i in L: # array iterator
L = [1] * n # TODO array->vtable->repeat
# or multiply? [1]
xrange(n) # Parrot slice iterator [2]
dict.fromkeys(iterable) # h."fromkeys"(iter, NULL) [3]
n += i # TODO bigint math [4]
[1] depends on the bytecode translator, which I don't have yet
[2] needs rework to support steps e.g. [ 0 .. n : 2 ]
[3] Python has a class method, that returns a new hash.
Parrot has an object meth, that fills the passed hash object.
If the iterable is xrange, integer keys are used in the hash.
[4] If none is jumping in, I'll link to libgmp for now and
implement needed basic mathematic functions, including
overflow checking in Integer PMC.
Any comments WRT Parrot feature translation are heatily welcome,
as well as of course volunteers for missing features like bigint
or array.sort().
The (hand-crafted, estimated) PIR version of b6.py could be ready
tomorrow.
Disclaimer: As time's flying like an arrow, I'm sure that implementing
tons of new features in such a short time, might very well lead to
suboptimal code and short-term compromises. A cleanup stage will follow
for sure, but likely after OSCON.
Have fun,
leo