Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.perl.modules > #232

Re: Tree::Range 0.1 released

From Ivan Shmakov <oneingray@gmail.com>
Newsgroups comp.lang.perl.modules, comp.lang.perl.misc
Subject Re: Tree::Range 0.1 released
Date 2013-06-27 13:11 +0000
Organization Aioe.org NNTP Server
Message-ID <871u7n8zrc.fsf@violet.siamics.net> (permalink)
References <87ip1igchz.fsf@violet.siamics.net> <87ppv87z1j.fsf@violet.siamics.net> <3ggt9a-22b2.ln1@anubis.morrow.me.uk> <87a9mb95l0.fsf@violet.siamics.net> <ohlt9a-upb2.ln1@anubis.morrow.me.uk>

Cross-posted to 2 groups.

Show all headers | View raw


>>>>> Ben Morrow <ben@morrow.me.uk> writes:
>>>>> Quoth Ivan Shmakov <oneingray@gmail.com>:

 >> One of the possible uses of Tree::Range::RB specifically is to
 >> operate on .newsrc data.  Consider, e. g.:

[...]

 >> my $comp_lang_perl_misc
 >>     = Tree::Range::RB->new ({ "cmp"     => sub { $_[0] <=> $_[1]; },
 >>                               "equal-p" => sub { $_[0] eq  $_[1]; } });

[...]

 >>     print ($comp_lang_perl_misc->get_range (28007));
 >>     ## => 1, 28006, 28009

[...]

 > Is this importantly different from Set::IntSpan/::Fast/::XS?

	Yes, although not in the case of .newsrc.

	First of all, each range (span, interval, etc.) may have an
	associated value.  It's "1" (or "undef", for the "complementary"
	ranges) in the example above, but it needs not to be.

	Moreover, unlike Set::IntSpan, Tree::Range::RB is applicable to
	an arbitrary ordered set.  (Note the "cmp" option above.)

	Also, having Set::IntSpan (and Set::IntSpan::Fast, as per the
	documentation) implemented on top of an ordered list seems to
	imply the insertion and deletion times of O (N), while for a
	red-black tree they're both O (log N).  Though ::XS may still
	outperform a pure-Perl tree-based implementation on reasonable
	use cases.

-- 
FSF associate member #7257

Back to comp.lang.perl.modules | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

a new Tree::Interval-like module on top of Tree::RB? Ivan Shmakov <oneingray@gmail.com> - 2013-06-13 17:13 +0000
  Tree::Range 0.1 released Ivan Shmakov <oneingray@gmail.com> - 2013-06-27 05:27 +0000
    Re: Tree::Range 0.1 released Ben Morrow <ben@morrow.me.uk> - 2013-06-27 07:47 +0100
      Re: Tree::Range 0.1 released Ivan Shmakov <oneingray@gmail.com> - 2013-06-27 08:12 +0000
        Re: Tree::Range 0.1 released Ben Morrow <ben@morrow.me.uk> - 2013-06-27 11:24 +0100
          Re: Tree::Range 0.1 released Ivan Shmakov <oneingray@gmail.com> - 2013-06-27 11:05 +0000
            Re: Tree::Range 0.1 released Ben Morrow <ben@morrow.me.uk> - 2013-06-27 12:50 +0100
              Re: Tree::Range 0.1 released Ivan Shmakov <oneingray@gmail.com> - 2013-06-27 13:11 +0000
                Benchmark-ing Tree::Range::RB? Ivan Shmakov <oneingray@gmail.com> - 2013-07-02 19:37 +0000

csiph-web