Jamey Cribbs
5/26/2005 8:30:00 PM
Oliver Cromm wrote:
>I found some time now for further experiments, and stored time as an
>integer. And yes, it is significantly faster this way, even slightly
>faster than my first attempt to do the same with SQLite.
>
>Times from some test with similar, not exactly equal tasks, so read with
>spoons of salt:
>- reading data fresh from News server: 50s
>- reading from KirbyBase with original format (rfc2822) Date field: 45s
>- reading from KirbyBase with Date as Integer: 12s
>- reading from SQLite with Date as Integer: 16s
>
>I have to do quite a number of calculations on that field; for every
>record selected (and in my simple experiments, that is nearly all of
>them), I need to extract at least the day of the week and the day
>number. But apparently, that doesn't take nearly as much time as a
>KirbyBase "select" based on ParseDate(aField). I'm not quite clear about
>what is going on with the select, but I know how to circumvent the
>problem.
>
>
If I remember my experiments correctly when I first ported KirbyBase
from Python to Ruby and noticed the significant speed difference when
using Date/Datetime, my guess was that there isn't anything going on in
#select that is causing the slowness. It is just that, in Ruby,
creating a new Date/DateTime object is relatively slow, compared to
Python. My further guess as to why this was is that, in Python, the
datetime library is written in C, while in Ruby, the Date/DateTime
library is written in Ruby. How's that for exhaustive scientific
analysis? :-)
I could be totally wrong about this, but I am guessing that if the
Date/DateTime library was re-written in C, it would be significantly
faster and you would likewise notice a marked speed improvement while
using Date/DateTime fields in KirbyBase. Unfortunately, since I am not
a C programmer, I can't actually do this to test my theory. Hence, my
workaround is to usually define any date fields I need as String
fields. It speeds things up and, for comparison purposes, things pretty
much work the same way.
Jamey
Confidentiality Notice: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. If you are not the intended recipient(s), you are hereby notified that any dissemination, unauthorized review, use, disclosure or distribution of this email and any materials contained in any attachments is prohibited. If you receive this message in error, or are not the intended recipient(s), please immediately notify the sender by email and destroy all copies of the original message, including attachments.