[pypy-dev] Re: psyco in Python was: Minimal Python project
tismer at tismer.com
Sat Jan 18 01:07:20 CET 2003
Thomas Fanslau wrote:
> And don't forget the obvious replacement of a multiply by some shifts,
> so multiply by 5 can be replaced by a copy, a right shift 2 places and a
> add instead of a costly multiply ...
Ok, my 2 Eurocent:
Also don't forget that this is not always true.
There is hardware that recognized such common
multipliers and does an optimization in hardware.
I once had such a chip for the Forth language.
This is not about to say you're wrong!
What I try to express is instead, that
we need to be aware of very different hardware,
where optimization can have very different
paths, and some assumptions may drive you very wrong.
While your optimization was absolutely worthy on
an 8086 processor, it becomes questionable for
a Pentium 4, since multiplication by an immediate
has been optimized like hell, and it is not sure
in the first place whether to use a single operation
that does the multiply, or by replacing it by three
operations which you propose.
There also can be considerations of occupation of
execution units, which can make a multiply cheaper,
since it can be done in parallel, while something
other is still happening.
This is all not relevant in the bootstrap phase.
But we will finally write optimized compilers.
(Dunno if Armin wants to, but I do).
What we need is an abstract model of processors,
caching, pipelines, parallel execution lines,
prefetches, all of that.
This is why I looked into MMIX. I no longer think
to use MMIX as a first micro engine target, since I want
something now, not something perfect. But that MMIX engine
has everything that I mentioned and more, it is very
close to current hardware development.
About my position in this project, I'm not completely
settled. But regardless of my actual tasks, I will
provide two things, as my personal pet projects:
- a) The fastest possible interpreted micro engine,
optimized for X86
- b) A very good code generator for X86 which produces
better code than gcc, MS-VC++ and IBM's C compiler.
These will both, of course, completely be done in Python.
There will not be a single line edited with a C editor.
Instead, I'm writing high-level Python code, which is
able to a) emit a suitable C source, and b) emit optimized
This just as a note what I'm ging to contribute, anyway.
maybe-I-spent-5-Eurocents-ly y'rs -- chris
Christian Tismer :^) <mailto:tismer at tismer.com>
Mission Impossible 5oftware : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34 home +49 30 802 86 56 pager +49 173 24 18 776
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
More information about the Pypy-dev