[Python-Dev] Parrot -- should life imitate satire?

Neil Schemenauer nas@python.ca
Fri, 3 Aug 2001 06:53:16 -0700


Simon Cozens wrote:
> On Wed, Aug 01, 2001 at 12:42:42AM -0400, Tim Peters wrote:
> > 		case BINARY_DIVIDE:
> 
> case? Wowsers. Hey, Ruby does that too. We use function pointers,
> FWIW.

People (including me) have tried using threaded code
(http://www.complang.tuwien.ac.at/forth/threaded-code.html) and have not
measured any significant advantage.  I suspect the opcodes to much
longer to evaluate than doing the dispatch.

> Oh, and here's our divide, for comparison:
> 
> PP(pp_divide)
> {
>     dSP; dATARGET; tryAMAGICbin(div,opASSIGN);
>     {
>       dPOPPOPnnrl;
>       NV value;
>       if (right == 0.0)
>         DIE(aTHX_ "Illegal division by zero");
>       value = left / right;
>       PUSHn( value );
>       RETURN;
>     }
> }

Does every Perl opcode do a function call?

  Neil