Math-SymbolicX-FastEvaluator
view release on metacpan or search on metacpan
lib/Math/SymbolicX/FastEvaluator.pm view on Meta::CPAN
=head2 WHY?
Two reasons: Experimentation and the distant hope of passing the expressions
to numeric optimization routines, which are naturally implemented in C,
C++, or even FORTRAN.
=head2 PERFORMANCE
Using all this combersome indirection, the evaluation of C<FastEvaluator>
expressions proceeded at a pace of over 200 million tokens per second on my
1.8GHz Core2 laptop which was busy with various desktop tasks at the same time.
A token is a number, variable or operator. Since I was
testing with a string of multiplications, this translates to roughly
100 MFLOPS. You can consider this fast or slow, but compared to Perl
evaluation, this is at least a factor of ten faster. When variables are added into
the picture, the improvement should be even larger.
Since the overhead of this method is still large compared to the actual
computation time, sums, differences, products and divisions are approximately
equally fast.
=head2 PORTABILITY
( run in 0.316 second using v1.01-cache-2.11-cpan-87723dcf8b7 )