Cache regexp test function, use Date.now()

Just two very small changes that improve mainly the readability (no more conversions of date objects to numbers, one function and a variable less).