Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^5: Bidirectional lookup algorithm? (Judy)

by Anonymous Monk
on Jan 12, 2015 at 02:04 UTC ( [id://1112918]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Bidirectional lookup algorithm? (Judy)
in thread Bidirectional lookup algorithm? (Updated: further info.)

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 ); } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1112918]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2025-07-13 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.