[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] date comparison is very, very, very slow (srfi-19)
From: |
Anthony Carrico |
Subject: |
[Chicken-users] date comparison is very, very, very slow (srfi-19) |
Date: |
Wed, 24 Sep 2008 14:33:49 -0400 |
User-agent: |
Mozilla-Thunderbird 2.0.0.14 (X11/20080509) |
I ran into an extreme slowdown with some code that uses dates. I thought
this was a complexity issue with sorting, or something like that, but I
noticed that it was mainly GC, and traced it to date<?.
Date comparison is done on julian-days, which are cached in dates, so it
is simplest to observe by running date->julian-day over some random dates.
The following code takes 16sec to do the equivalent of 1000 date
comparisons on an AMD Athlon(tm) X2 Dual Core Processor BE-2400:
(require-extension srfi-19) ;; time
(define random-date
(lambda ()
(make-date
0
(random 60)
(random 60)
(random 24)
(+ 1 (random 27))
(+ 1 (random 12))
(+ 2000 (random 10))
0)))
(define random-dates
(lambda (n)
(map (lambda (ignore) (random-date)) (make-list n))))
(time (map date->julian-day (random-dates 2000)))
$ csc ox-date.scm
$ ./ox-date
16.393 seconds elapsed
16.117 seconds in (major) GC
8272 mutations
0 minor GCs
7681 major GCs
signature.asc
Description: OpenPGP digital signature
- [Chicken-users] date comparison is very, very, very slow (srfi-19),
Anthony Carrico <=
- Re: [Chicken-users] date comparison is very, very, very slow (srfi-19), Alex Shinn, 2008/09/25
- Re: [Chicken-users] date comparison is very, very, very slow (srfi-19), Kon Lovett, 2008/09/25
- Re: [Chicken-users] date comparison is very, very, very slow (srfi-19), Alaric Snell-Pym, 2008/09/25
- Re: [Chicken-users] date comparison is very, very, very slow (srfi-19), Anthony Carrico, 2008/09/25