bmuller/ankusa — pull request #7 by rurounijones (2014-06-03 22:57:33+00:00)
Title: Replace check method to see if a string is numeric

The old code used the very correct Float(word) method to see if a string
was numeric. This works reliable with all sorts of edge-case data but it
is very slow.

Since we have already parsed out a lot of possibilities during word
atomisation (e.g. decimal numbers like 123.45 have already been split
into "123" and "45") we do not need this level of "dealing with edge"
case surety.

Therefore we can just do a simple regex check to see if the string is
all numerals or not.

In tests on 1000 emails (Single threaded) the run-time was reduced
from 2.4 seconds to 1.4 seconds.

Since we have traded edge-case reliability for speed we can no longer
leave this as a String class monkey-patch so move it into a method that
will only be called by Ankusa itself