Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^7: A list assignment gotcha (Speed)

by LanX (Saint)
on Aug 01, 2020 at 09:26 UTC ( [id://11120185]=note: print w/replies, xml ) Need Help??


in reply to Re^6: A list assignment gotcha (Updated)
in thread Not understanding 2 sentences in perldoc

First of all choroba's code can be easily sped up by replacing the ->new with a direct bless

Syntax is rarely about speed otherwise you would do it right away in assembler.

In this particular example speed ups could be implemented if multiple operations happen

Something like

speed { L ($x, $y) * 3 + [5,6] + L (@z) };

wouldn't even need XS to be efficient, the objects inside the block would return optimized Perl code which is eval'ed only once and then reexecuted inside an inner loop.

With Keyword::Simple° even the overhead of calling speed could be avoided by inlining the code at compile-time.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

°) which has an XS dependency but only needs Perl to be used.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-03-28 20:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found