in reply to High Performance Perl

Perl's current implementation doesn't really have bytecode, at least not in the sense that Java or Python does. Rather, it takes the tree generated by the parser and starts interpreting it directly. In Java or Python, there is another step where the tree is translated to bytecode and then the bytecode is interpreted.

The advantage of interpreting the tree is that the compile phase is fast--you're pretty much done as soon as the parser is finished. However, it also makes it difficult to write the compiler's output to disk--abstract syntax trees are a lot messier than simple bytecode.

Future Perls will be generating bytecode for Parrot.

"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

Replies are listed 'Best First'.
Re^2: High Performance Perl
by Juerd (Abbot) on May 24, 2005 at 17:50 UTC

    Perl's current implementation doesn't really have bytecode, at least not in the sense that Java or Python does.

    Hmmm. Then what do B::Bytecode and ByteLoader do?

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

      Take the tree Perl normally uses, make it into bytecode, and then load it back into a tree for Perl to use later. They don't have anything to do with how Perl runs the program internally. Notice that it doesn't work very well for any non-trivial code, and you aren't gaining anything except shaving off the compile-time.

      "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.