liyang/thyme — pull request #18 by klao (2014-04-08 16:03:31+00:00)
Title: Data.Thyme.Calendar.Internal.isLeapYear: simplify and make faster

This also makes it compile with GHC 7.8 and thus fixes #15.

I looked at this because `thyme` wasn't building with GHC 7.8-rc2, and I realized that it's possible to make this function faster while fixing this. Doing bit operations is _much_ faster than dividing by 4.

I did a quick benchmark and the original code runs in 20-40ns (20 on eg. 1999 - the easiest case, 40 on 1900 - the hardest case). The improved code runs in 10-20ns (halved for both cases).

I was playing with these things recently while working on `tz`. For example I have more than 2 times faster `toOrdinalDate` implementation. I'll send you a few pull requests with these, if you don't mind.