in reply to Re: Size of Judy::HS array: where is MemUsed()?
in thread Size of Judy::HS array: where is MemUsed()?

G'day hv,

++ Thanks for your response.

"What happens if you try to call it?"

A common alias of mine:

$ alias perle alias perle='perl -Mstrict -Mwarnings -Mautodie=:all -MCarp::Always -E +'

I originally just tried to import it. My code crashed at that point; like this:

$ perle 'use Judy::HS "MemUsed"'; "MemUsed" is not exported by the Judy::HS module at /home/ken/perl5/pe +rlbrew/perls/perl-5.36.0/lib/site_perl/5.36.0/Sub/Exporter.pm line 77 +8. Sub::Exporter::_do_import(HASH(0xa003f6ab8), ARRAY(0xa005d7d00 +)) called at /home/ken/perl5/perlbrew/perls/perl-5.36.0/lib/site_perl +/5.36.0/Sub/Exporter.pm line 744 Sub::Exporter::__ANON__("Judy::HS", "MemUsed") called at -e li +ne 1 main::BEGIN() called at -e line 1 eval {...} called at -e line 1 BEGIN failed--compilation aborted at -e line 1.

I basically took the documentation at face value and assumed that I needed something in addition to libJudy. However, I now see that a fully-qualified name will access it:

$ perle 'use Judy::HS "Set"; my $judy; Set($judy, Key => 42); say Judy +::HS::MemUsed($judy);' 59
"I took a brief look at the code, and it looks buggy ... If you're happy to run a patched version, I can provide a one-line fix for the obviously buggy case."

I've just been tinkering with it; comparing $judy with %hash. I've written some basic benchmarks to test speed; I looked into some of the Unicode issues raised in Judy::Mem; and was planning to do a size comparison as well. Depending on how all of that panned out, I had some tentative thoughts on other aspects to investigate.

Some of my $work involves biological data which, as I'm sure you're aware, can be huge and require long processing times. I'm always on the lookout for more bang-for-your-buck in this area. Having said that, given your comment that "it looks buggy", and the fact that it appears to be abandonware, I'm wondering if this is worth pursuing. In light of that, while I very much appreciate your offer of supplying a patch, I think I need to give some serious consideration as to whether I'll continue with Judy & Co. before taking you up on that.

— Ken

Replies are listed 'Best First'.
Re^3: Size of Judy::HS array: where is MemUsed()?
by hv (Prior) on Apr 08, 2023 at 09:57 UTC

    I think maybe you were misled by the wording of "This implementation is not supplied by libJudy". I read it as "while other functions in this package are simple wrappers around functions provided by the external library, this function I wrote myself".

    In the event, that looks like a useful warning: it seems quite possible that the external library is solid, and that the simple wrappers do indeed simply wrap. In which case you may well get entirely reliable behaviour with those, even if the additional functionality added by the author is less solid.

    In any case I've added the patch as a ticket on Judy's queue, so it's there if you need it: id=147637.

      "I think maybe you were misled by the wording ..."

      That's entirely possible; thanks for the follow-up.

      This has left me feeling somewhat more confident about the Judy modules than I was earlier today. As per "Re^2: Size of Judy::HS array: where is MemUsed()?", I may be able to avoid MemUsed() entirely; but thanks for the patch anyway. Also from that same node, I'll be picking up from where I left off after Easter.

      — Ken