From: Rick DeNatale Date: 2009-08-18T21:00:05+09:00 Subject: Re: ANN: ThirdBase 1.2.0 On Mon, Aug 17, 2009 at 7:59 PM, Jeremy Evans wrote: > Roger Pack wrote: >>> ThirdBase is a replacement for Ruby's standard Date/DateTime >>> classes, with the following differences: >>> >>> - ThirdBase is roughly 2-10 times faster depending on usage >> >> How does it compare to http://tomayko.com/src/date-performance/ > > I haven't used Date::Performance, but from reading that page, > Date::Performance would certainly be faster as it is implemented in C. > ThirdBase is pure ruby code. > > ThirdBase uses customizable regexp-based parsers as opposed to a fixed > string scanning parser, so it is probably more flexible. > > I can't comment in more detail without reading the Date::Performance > code. Both Date::Performance and ThirdBase seem to focus on the performance of datetime parsing. I took a quick look at the Date::Performance code, and it definitely is taking the approach of re-implementing a few key methods in C. I suspect that most of the performance comes from calling the Clib strptime routine, less so from the 'ruby-inlined' methods. In implementing RiCal http://github.com/rubyredrick/ri_cal/tree/master my main performance problem with datetime was date time calculations. Because of the standard datetime implementation using a rational fraction to represent the time-of-day portion of a datetime the performance profiles were dominated by the gcd calculations needed to reduce rational numbers. So in my case I replaced the internal use of datetime instances with a custom class which uses a normal Ruby date and a fixnum representing the number of seconds since the beginning of the day, no C code, all ruby and much much faster for my purposes. But not at all a general replacement for datetime. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale