Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

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

On a moderately loaded Solaris machine, alias keeps ahead of ref, but it seems that the string length dominates the speed, as both rates get lower and closer to each other with no signs of one overtaking the other:

Length of string: 1000 Rate ref alias alias 141243/s 58% -- ref 89366/s -- -37% ... Length of string: 10000 Rate ref alias alias 45496/s 19% -- ref 38388/s -- -16% ... Length of string: 20000 Rate ref alias alias 25947/s 12% -- ref 23186/s -- -11%

This is for

This is perl, v5.8.4 built for sun4-solaris-64int (with 27 registered patches, see perl -V for more detail)

On a different machine, also moderately loaded, I see practically the same, also with alias keeping (barely) ahead of ref as the string size increases:

Length of string: 1000 Rate ref alias alias 404858/s 115% -- ref 187970/s -- -54% Length of string: 2000 Rate ref alias alias 367647/s 87% -- ref 196850/s -- -46% ... Length of string: 10000 Rate ref alias alias 220751/s 24% -- ref 177936/s -- -19% ... Length of string: 18000 Rate ref alias alias 168067/s 2% -- ref 165563/s -- -1% Length of string: 19000 Rate alias ref ref 162866/s 1% -- alias 161551/s -- -1% Length of string: 20000 Rate alias ref ref 162602/s 2% -- alias 160000/s -- -2%

Here, the decrease in repetitions is more dramatic for alias as the string length increases, which I interpret as the runtime overhead of alias being really minuscule compared to the overhead of the other operations performed.

This is on a HP-UX machine with Intel architecture:

This is perl, v5.8.8 built for IA64.ARCHREV_0-thread-multi (with 33 registered patches, see perl -V for more detail) Copyright 1987-2006, Larry Wall Binary build 817.1 [268662] provided by ActiveState http://www.ActiveS +tate.com Built Sep 19 2006 13:53:03

Interestingly, trying this with Strawberry 5.10.0, I see your reversal (Intel architecture):

Rate ref alias ref 258065/s -- -46% alias 477783/s 85% -- ... Length of string: 10000 Rate alias ref alias 123533/s -- -25% ref 164528/s 33% -- ... Length of string: 20000 Rate alias ref alias 65509/s -- -42% ref 112867/s 72% --

This is for

This is perl, v5.10.0 built for MSWin32-x86-multi-thread

Trying on the same machine with Strawberry 5.8.8, I get

Length of string: 1000 Rate ref alias alias 511771/s 53% -- ref 335121/s -- -35% Length of string: 2000 Rate ref alias alias 383289/s 28% -- ref 299043/s -- -22% Length of string: 3000 Rate ref alias alias 318471/s 14% -- ref 279486/s -- -12% Length of string: 4000 Rate ref alias ref 256016/s -- -2% alias 262329/s 2% -- Length of string: 5000 Rate alias ref alias 219154/s -- -7% ref 236183/s 8% -- ... Length of string: 10000 Rate alias ref alias 121448/s -- -29% ref 170707/s 41% -- ... Length of string: 20000 Rate alias ref alias 67801/s -- -39% ref 111694/s 65% --

This was with:

This is perl, v5.8.8 built for MSWin32-x86-multi-thread

So, at least judging from the limited set of versions and platforms, things point in the direction of Windows or MSVC to be responsible for the dramatic slowdown although I'm at a loss as to what part might be causing the slowdown.


In reply to Re: Pass by ref vs alias : why does scalar size matter? by Corion
in thread Pass by ref vs alias : why does scalar size matter? by clinton

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 musing on the Monastery: (4)
As of 2024-04-23 23:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found