First, is the problem that it takes too long, or that it uses too much CPU? If it's that it takes too long, you need to profile wall time, not CPU time. If your application does any significant I/O, that's almost certainly the time bottleneck, and you won't see it when profiling CPU time. Until you've done this, forget about method call overhead and inline functions.
Next, stop using fields. The feature you're referring to was called pseudohashes and it was killed a long time ago (5.8 I think) because it caused problems and didn't deliver on the expected improvements. If you want hashes that don't autovivify keys, use Hash::Util::lock_keys(). If you're not on 5.8 yet, it would be a good move to get there.
-
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.
|