Admittedly, I haven't looked at this module (or really tied things in general recently), but isn't there always an additional speed hit for using a tied variable? AFAIK, this hasn't been optimized away, but, as I said, I haven't kept up on the subject.

Due to the potential for "big" speed hits, I'd look at something like this as merely a stopgap to keep you from shooting yourself in the foot until you've moved over to an accessor/mutator based approach (dealer's choice as to how). Yes, yes, there's also a performance hit from using accessors vs direct hash keys, but it's usually going to be less than the hit you'd get from using a tied hashref.

That way you could drop in the tying widget to stop the bleeding now, but you slow down your system slightly. Next step is to get rid of the calls to the keys and replace 'em with accessors. Step 3 is to pull the tied hash back out and get a raise for optimizing the code, conveniently leaving out the part that you slowed it down to begin with. ;-)


In reply to Re^2: Using the strict module in object oriented programming by jimt
in thread Using the strict module in object oriented programming by mrguy123

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.