Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

So in other words, Raku is a better designed language.

Actually no. That is not the correct view.

Raku is actually a designed language. Perl is an accumulation of parts that mostly work together.

The main reason grammars are slow is because basically no one has touched the slow parts of it for the better part of a decade. We have some knowledge about how to speed it up because earlier prototypes had those optimizations.

The thing is, that it isn't that slow. Or rather it isn't that slow considering that you get an actual parse tree.

If you must know, the main reason it is slow is probably because it sometimes looks at particular tokens perhaps a half-dozen times instead of once. (This is the known optimization that was in one of the prototypes that I talked about.)

It has absolutely nothing to do with being able to replace what whitespace matches. That is already fairly optimized because it is a method call, and we have optimizations which can eliminate method call overhead. Since regexes are treated as code, all of the code optimizations can apply to them as well. Including the JIT.


Really if Perl doesn't do something drastic, in five to ten years I would suspect that Raku would just plain be faster in every aspect. (If not sooner.) The Raku object system already is faster for example. (And that is even with MoarVM having to be taught how Raku objects work every time it is started.)

Something like splitting up the abstract syntax tree from the opcode list. That way it can get the same sort of optimizations that Raku has that makes it faster than Perl in the places where it is faster.

Imagine if the code I posted would turn into something more like this:

loop ( my int64 $i = 1; $i <= 1_000_000_000; ++$i ) {}
Or rather transform that into assembly language. Which is basically what happens for Raku. (Writing that directly only reduces the runtime by a little bit more than a second.)

It seems like every year or two we get a new feature or a redesign on a deep feature that speeds some things up by a factor of two or greater. Since Perl is more stratified than designed, it is difficult to do anything of the sort for it.


Also I don't know why we would want to downgrade to LLVM. (Perhaps it can be made to only be a side-grade.)

As far as I know LLVM only does compile-time optimizations. The thing is that runtime optimizations can be much much better, because they have actual example data to examine.


Perl is an awesome language.
Raku is an awesome language in the exact same ways, but also in a lot more ways as well.
Many of those ways make it easier to produce faster code.


In reply to Re^12: Modernizing the Postmodern Language? by b2gills
in thread Modernizing the Postmodern Language? by WaywardCode

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-25 08:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found