Esteemed monks,

I've run into a frustrating performance problem using Storable.

I have an application that uses Storable to freeze/thaw large hashrefs as scalars in a database. The large hashref in question holds an arbitrary number of pieces of information about an arbitrary number of job applicants in the form:

$data->{$data_id}->{$applicant_id} = $value;

The hashref is then used to generate reports on the data. The idea being that subsequent runs of the report don't need to retrieve all the data again.

I get significant performance improvements compared to fetching the data every time for smaller sets of data but once the dataset reaches a certain size (approximately 3 $data_id's and 7500 $applicant_id's) the performance degenerates horribly.

A dprofpp trace shows that it's the freezing and not the thawing that's the problem, and strangely, the problem only occurs if the freeze takes place after a thaw in the same run. And also the problem does not occur if I store/retrieve to a file, unfortunately this is not an option in our production environment.

On the face of it it seems like some sort of memory bottleneck but the development machine has plenty and never swaps. I had a look at the XS code but it's been a long time since I looked any C code and it was way over my head.

Basically, has anyone come across this before? or is there anything I can try to improve things?

Many Thanks


In reply to Storable::freeze performance problem by Smoothhound

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.