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

comment on

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

A large part of the growth in time cost is the way the tmps stack was being grown.

On Linux, at least some BSDs, realloc() for large allocations is handled through munmap() system call, making such allocations close to constant time. On Windows realloc() is O(size of original allocation) when the allocation can't be grown in place, since the data needs to be copied from the original allocation to the new allocation.

Before fea90cfbe1f221d50be90ca5ceb0c6c7f121e442 the tmps (or mortal) stack was being grown linearly, adding 512 entries each time the stack was grown. This dominated the execution cost for the match and io(list) no-heat cases.

With fea90cfbe1f221d50be90ca5ceb0c6c7f121e442 the tmps stack is now grown exponentially (1.5**n) like other similar allocations such as the value stack, arrays. This changes the cost to amortized constant time.

The pre-heat in each case grew the tmps stack in one big allocation, preventing the incremental growth that caused the problem.

In reply to Re: Strawberry: Both IO and global match are VERY SLOW. Unless pre-heated (but why?) by tonyc
in thread Strawberry: Both IO and global match are VERY SLOW. Unless pre-heated (but why?) by Anonymous Monk

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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-06-16 03:37 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.