I am assigned the task of optimizing one PERL code which takes approx. 18 hours to execute. I have read the entire code and found that the code reads around 55000 to 60000 entries from LDAP Server and then fetch them into a HASH ed_en and then updates/creates entries in LDAP Server.

Hash structure is like this:
%ed_en = { '069836' => 'p1', '025939' => 'p2', ... }
#with p1 a pointer (ie address like 0x123454) towards the corresponding entry received from ldap_search #with p2 a pointer (ie address like 0x123456) towards the corresponding entry received from ldap_search

%p1 = { 'dn' => 'st-eduid=ed988766,ou=People,dc=xyz,dc=com } %p2 = { 'dn' => 'st-eduid=ed123456,ou=People,dc=xyz,dc=com }
Further, few hashes are created from this HASH for easier processing of the subroutines.

Systems uses version PERL 5.005_03 built for sun4-solaris.

Any help would be appreciated.

Thanks & Regards, Sukhi

In reply to Optimize my code with Hashes by sukhicool

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.