Speed up the Vector math methods a bit.
commita4df22aef6f91fcc42585b15c7c573b77cfc9580
authorMark Glines <mark@glines.org>
Sun, 8 Jun 2008 13:52:08 +0000 (8 06:52 -0700)
committerMark Glines <mark@glines.org>
Sun, 8 Jun 2008 13:52:08 +0000 (8 06:52 -0700)
treebca167f129deef611d01028cff30ffe5c3f1e2ab
parent5ddc8f40e67bedb515b2d0fee91631185028eda3
Speed up the Vector math methods a bit.

Reduce the number of subroutine calls, and reduce the number of
times each piece of data has to be touched.

I have two very CPU-intensive tests in my AI project, which end
up calling a couple hundred thousand math ops during the course
of their execution.  This patch speeds up those tests by about
12%.

Execution times for those two tests, before and after the patch
(in seconds):
07rules_ttt.t before: 29.02 28.63 29.18
07rules_ttt.t  after: 25.83 25.21 25.36
10population.t before: 32.06 31.76 31.59
10population.t  after: 27.74 28.04 27.34
lib/Language/Befunge/Vector.pm