Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^5: Perl 5 Optimizing Compiler, Part 7: Video Chat w/ Ingy & Reini, Today 9/18 8pm Central Time

by Will_the_Chill (Pilgrim)
on Sep 18, 2012 at 07:43 UTC ( [id://994226]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Perl 5 Optimizing Compiler, Part 7: Video Chat w/ Ingy & Reini, Today 9/18 8pm Central Time
in thread Perl 5 Optimizing Compiler, Part 7: Video Chat w/ Ingy & Reini, Today 9/18 8pm Central Time

chromatic,

Can you please elaborate on the proper & improper places for Perl5's polymorphisms?

Thanks,
~ Will

Replies are listed 'Best First'.
Re^6: Perl 5 Optimizing Compiler, Part 7: Video Chat w/ Ingy & Reini, Today 9/18 8pm Central Time
by chromatic (Archbishop) on Sep 18, 2012 at 20:44 UTC

    For example, every Perl 5 op has to check if its operands are tied or have other magic attached. That's at least one if clause in every op (but I repeat myself).

    Compiling Perl 5 with clang won't help that at all because the types of the operands aren't known until you run a Perl 5 program.

    If, instead, the internals had separate types of variables depending on the attached magic such that the code to get a value from a tied scalar were a part of the tied scalar and not in every op, a lot of code could go away. A lot of conditionals could go away, especially for the common case where most scalars aren't tied scalars.

    (Doing that in C like Parrot does doesn't really help much, because even a good optimizing C compiler can't optimize the trailer park polymorphic dispatch you have to write by hand to get something remotely like an object system in C. Chip had the right idea with Topaz, except that cross-platform C++ was awfully hard to support then.)

    You can speed up op dispatch all you want, but the slow part of Perl 5 is the part that manages data.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://994226]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-03-19 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found