Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Secondly, any impedance mismatch between perl and javascript is going to give you agonisingly slow performance. For example, if the full semantics or perl hashes can be provided by javascript dictionaries or objects say, then you can directly translate $foo{bar} into foo.bar or whatever. If however, the javascript facilities aren't suitable, then you might end up having to implement a Perl-style hash using javascript code, which is going to be slow. Also what tends to happen in these sorts of conversions is that the early proof-of-concept work (which uses a javascript dict say) works well and is really, really fast. Then you reach the point where you've done 50% of the work and its going really well, Then you get round to implementing the 'each' op, and suddenly realise that it can't be done using a javascript dict. So you switch to the slow route

This rings so true.

I've seen the same thing several times in Perl 6 compilers that targeted other high-level languages (for example kp6 comes to mind, which had a Perl 5 backend). It became so slow that hacking on it wasn't fun anymore, so people stopped hacking on it. (I think perlito descended from kp6 though).

Rakudo had the same problem, parrot's object system didn't fit it. So it had a huge rewrite switching to a custom object system, which only worked because much of it could be written in C. If it had to be done on top of parrot primitives, it could have never worked with decent speed.

And the problem is, there are so many fundamental operations that have subtle differences between both Perl 5 and Perl 6 and possible target languages like Javascript: routine invocation (think of @_ elements being aliases), method dispatch, hash and array access (think of autovivification, or what hashes return in scalar context in Perl 5). You might be able to take the speed hit from adapting one of them the right semantics, but all of them put together will kill you.

I am now convinced that targeting a high-level language like javascript isn't going to result in a speedup. I hope somebody proves me wrong eventually.


In reply to Re^2: Perl 5 Optimizing Compiler, Part 5: A Vague Outline Emerges by moritz
in thread Perl 5 Optimizing Compiler, Part 5: A Vague Outline Emerges by Will_the_Chill

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (10)
    As of 2014-07-25 10:28 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (170 votes), past polls