A short session with Devel::Profile led me from this:
time elapsed (wall): 17.6237 time running program: 13.2164 (74.99%) time profiling (est.): 4.4072 (25.01%) number of calls: 526792
To this:
time elapsed (wall): 11.4355 time running program: 8.7706 (76.70%) time profiling (est.): 2.6649 (23.30%) number of calls: 301198
Next, I'll be taking a look at Devel::Cover and Devel::SmallProf (which, coincidentally, is by the author of Language::Prolog::Yaswi, a "competitor" module to AI::Prolog).
Regrettably, to get that sort of performance enhancement, I had to engage in some serious encapsulation violations. This will make some further refactorings more difficult. I wonder if I made a mistake?
I've also noticed that some people's tests are failing. I can't replicate it on my machine, but it looks suspiciously like Scalar::Util::looks_like_number fails on 5.8.4 if the number is undefined. This doesn't seem right, though, as this is such a common function. Of course, I see that both of those failures are on boxes my boss owns. Perhaps a plot? On the other hand, all but one of the test reports are from boxes he owns. How depressing. I guess people aren't downloading it after all.
$ perl -v
This is perl, v5.8.4 built for i686-linux
Copyright 1987-2004, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.
$ perl -MScalar::Util -le 'print Scalar::Util::looks_like_number(undef)'
1
Re:looks_like_number on 5.8.4
Ovid on 2005-02-24T20:54:17
Yup, that's a bug.
[ovid@tomis ovid]$ perl -v
This is perl, v5.8.6 built for i686-linux-thread-multi
Copyright 1987-2004, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
[ovid@tomis ovid]$ perl -MScalar::Util -le 'print Scalar::Util::looks_like_number(undef)'
0Re:looks_like_number on 5.8.4
Ovid on 2005-02-24T20:57:04
Though it occurs to me to wonder what version of Scalar::Util you have? If it's an older version, maybe I can just require the latest?
Re:looks_like_number on 5.8.4
link on 2005-02-24T21:55:42
There were some changes to perls internal looks_like_number function about a year ago. Possibly related(or not) to this issue
http://tinyurl.com/5k6t7/
http://tinyurl.com/598qj
Re:looks_like_number on 5.8.4
Ovid on 2005-02-24T22:09:07
That looks like the problem. I'll just need to add a test for defined in the code.