FWIW these are the memory savings as reported by pslist
it begins 0.734375 WVM: 21976 { WS: 5948 VM: 3164 } after perl add 2.078125 WVM: 157152 { WS: 120132 VM: 117276 } after perl get 0.75 WVM: 157152 { WS: 120140 VM: 117276 } after free perl 1.5 WVM: 153184 { WS: 74936 VM: 72072 } it begins 0.4375 WVM: 21976 { WS: 5948 VM: 3164 } after jAdd 3.734375 WVM: 50648 { WS: 35500 VM: 32644 } after jGet 3.84375 WVM: 50648 { WS: 35512 VM: 32644 } after jFree 1.171875 WVM: 50716 { WS: 7988 VM: 5092 }

And the Judy code

BEGIN { my $j_str_to_int; my $j_int_to_strPtr; sub jAdd { ## my( $int, $str ) = @_; Judy::SL::Set( $j_str_to_int, $_[1], $_[0] ); Judy::L::Set( $j_int_to_strPtr, $_[0], Judy::Mem::String2Ptr( +$_[1] ) ); return; } sub jGetInt { ## string to int ## my( $str ) = @_; my( $intPtr, $int ) = Judy::SL::Get( $j_str_to_int, $_[0] ); return $int; } sub jGetStr { ## int to str ## my( $int ) = @_; my( $ignore, $strPtr ) = Judy::L::Get( $j_int_to_strPtr, $_[0] + ); return Judy::Mem::Ptr2String( $strPtr ); } sub jFree { { my ( undef, $value , $key ) = Judy::L::First( $j_int_to_st +rPtr , 0 ); while ( defined $key ) { ( undef, $value, $key ) = Judy::L::Next( $j_int_to_str +Ptr , $key ); defined $value and Judy::Mem::Free( $value ); } } Judy::SL::Free( $j_str_to_int ); Judy::L::Free( $j_int_to_strPtr ); } }

In reply to Re^5: Bidirectional lookup algorithm? (Judy) by Anonymous Monk
in thread Bidirectional lookup algorithm? (Updated: further info.) by BrowserUk

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.