DBM::Deep has the following file parameters:
# max_buckets: the number of entries that can be added before a reindexing, [16..256], default 16.

# data_sector_size: the size in bytes of a given data sector. [32..256], default 64.

Assume I have a representative sample of the data that would be stored. I want to choose parameter values to optimize the speed and diskspace performance. I would prioritize speed, but I would give up a few percentage points for a big improvement in disk space.

I have a script that will read several GB of input data and create/update the hash/db file, then output some of the hash data in table format. Processing time can take several days, and the db file size can be several GB also. Space isn't too restrictive, but obviously I want to take up less rather than more.

Is there some intelligent approach to optimizing these values, such as by inspection of my sample data? For example, what if I knew what the mean, median, or mode strings for keys and values were? Or the mean/median/mode hash depth? Note that the hash structure and contents depend on command line options (given the same input), so in some cases I would want the D::D parameters to change also. [I know that once the D::D file is written, these parameters can't be changed.]

Or should I just run benchmarks on all (power of two?) combinations of these parameters?

-QM
--
Quantum Mechanics: The dreams stuff is made of


In reply to Optimizing DBM::Deep file parameters by QM

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.