Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Why doesn't perl optimize this?

by BrowserUk (Pope)
on Jun 04, 2013 at 02:20 UTC ( #1036862=note: print w/replies, xml ) Need Help??

in reply to Why doesn't perl optimize this?

Why doesn't perl optimize the former code to only produce one huge array?

Because no one has programmed it to do so. And that in major part is because there is no call for it.

The number of occasions when such an optimisation would be triggered is so few. Very few people would construct an anonymous array, from a list, from an existing array, in order to return a reference.

Conversely, the cost of checking for those extremely rare opportunities would have to be paid for every subroutine that returned an array reference.

Its a high-cost, low-benefit complication to the core that no one has seen fit to write.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1036862]
[1nickt]: The Google-fu is strong with this one.
[1nickt]: I was looking at Best Buy since like the in-store return/repace plan ... but the 17" HP Envy they have is not this one ....
[1nickt]: May be brand new ... 0 reviews on the site.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2017-03-26 18:20 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (315 votes). Check out past polls.