[Snowball-discuss] Benchmarking (... On a lovely Sunday morning)

Teodor Sigaev teodor@stack.net
Tue, 23 Apr 2002 20:23:14 +0400


Hello.

> Perl's features.  I'll also try to run it against the Lingua::Stem::Snowball
> module recently submitted to this list, to see if that isn't the best solution for
> speed in Perl.  I think it makes more sense to interface, but it's not uncommon
> to have both an interface and native implementation(s).

[...]
> 
> -- Lingua::Stem --
> 1       : candidatus -> candidatu       24 wallclock secs (22.45 usr +  0.00 sys = 22.45 CPU) @ 2227.64/s (n=50000)
> -- Lingua::Stem --
> ... 
> -- bench-lingua-stem.pl --
> #!/usr/bin/perl
> use Lingua::Stem qw(:all);
> use Benchmark;
> 
> my @word = grep chomp, <>;
> my ($n,$pu,$ps) = (0,0,0); my $s = 10;
> for (1..$s) {
>   my $result;
>   my $w = @word[rand(scalar(@word))];
>   my $t = timeit(100000, sub { ($result) = @{stem($w)} } );
>   print "$_\t: $w -> $result\t",timestr($t),"\n";
>   $pu+=$t->[1]; $ps+=$t->[2]; $n+=$t->[5];
> }
> printf  "Average random cross-sectional stem rate for $s words: %5.2f Hz (n=%d).\n", $n/($pu+$ps), $n;

Is it script for Lingua::Stem::Snowball? If it is, what is function stem()?
Lingua::Stem::Snowball isn't provide function stem(), stem is a method of object 
Lingua::Stem::Snowball. Function is named as snowball(). BTW, using function 
snowball() you must get significant perfomance degradation, because it construct
  Lingua::Stem::Snowball's object internally :). Instead let you use stem() method.

-- 
Teodor Sigaev
teodor@stack.net



_______________________________________________
Snowball-discuss mailing list
Snowball-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/snowball-discuss