Re: Bytecode machines (and pyrex and psyco)

"Mark Hahn" <[email protected]>
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
Jonathan Gardner wrote:
> It was my understanding that Parrot (the new register-based bytecode
> machine) gives very, very successful results that challenge even the
> speed of C. Despite their academic unsavviness, register based
> machines are well understood and fast.
>
> You are talking about taking Prothon and whatever machine it is
> working on and executing code at a lower level for speed (via Psyco
> and Pyrex type enhancments). I think we should examine the core
> reason for Python's original slowness.
>
> I understand that Python currently uses a stack-based machine. These
> have been shown to be slow, but easy to implement. While academics
> enjoy the simplicity and theoretical completeness of stack-based
> machines, actual implementations are slow. The only way to make a
> stack-based machine faster is to move off of the stack and into a
> lower level.

You may be right.  It would reduce the number of instructions. Prothon has
only a few low-level stack instructions like push and pop but they are used
often to set up parameters for the high-level instructions.

The biggest advantage of registers is that you can optimize the reuse of old
values laying around in registers which you cannot do in a stack.  This
optimization step can be done as almost an afterthought after compiling.

I have said often that I will not do static compile optimization, but this
is a different kind of beast.  This is an internal register usage
optimization that I would be happy to do.

Damn, you.  Now I have to put even more work on my to-do list for the next
phase...

> If you were to take either Parrot or some other register-based
> machine and use that as the machine for Prothon, then you would
> probably get most of the speed you want. Optimizations would be added
> at two levels. First, you can compile prothon code to more efficient
> bytecode for the machine. Second, you can write a more intelligent
> machine that uses optimizations.

I would never use parrot.  I need the interpreter to optimize the use of my
objects.  I have bytecodes like expand-list, create-slice, etc.  The jit
will do these high-level operations in machine language for the ultimate
speed.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.