Speed up tests

This speeds up the tests, mostly by:
 * speeding up some of the code
 * parallelizing the slowest test

Some of the code speed up required some extra calendar-type constants to be
cached (indexed days of month, etc) - I took this opportunity to move them into
a class.

The memoization of some functions has been altered so that the calendar type
is also cached and compared - this means that it's safer to switch calendars after
previous computation has been done.

@arjclark, please review.