chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] date comparison is very, very, very slow (srfi-19)


From: Anthony Carrico
Subject: Re: [Chicken-users] date comparison is very, very, very slow (srfi-19)
Date: Fri, 26 Sep 2008 13:53:30 -0400
User-agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509)

felix winkelmann wrote:
> An overhaul of the compiler is definitely on the agenda. Unfortunately
> this needs time and manpower.

You guys probably have good intuition, but also it would be nice to
extend profiling down into the date library before jumping to any
conclusions. BTW Felix, thanks for the timing and profiling options
built into Chicken, which I used to get this far.

A slot-by-slot comparison (as suggested above) speeds up my program by
two orders of magnitude. Good enough for me, for now. Thanks to everyone.

This problem has got me scanning the Chicken mailing list more closely
than I have for a long time. The hygienic work you guys are doing sounds
pretty interesting.

(define date<?-fast
  (lambda (x y)
    (if (= (date-zone-offset x) (date-zone-offset y))
        (or
         (< (date-year x) (date-year y))
         (and
          (= (date-year x) (date-year y))
          (or
           (< (date-month x) (date-month y))
           (and
            (= (date-month x) (date-month y))
            (or
             (< (date-day x) (date-day y))
             (and
              (= (date-day x) (date-day y))
              (or
               (< (date-hour x) (date-hour y))
               (and
                (= (date-hour x) (date-hour y))
                (or
                 (< (date-minute x) (date-minute y))
                 (and
                  (= (date-minute x) (date-minute y))
                  (or
                   (< (date-second x) (date-second y))
                   (and
                    (= (date-second x) (date-second y))
                    (< (date-nanosecond x) (date-nanosecond y))))))))))))))
        (error "date<?-fast needs zone offset support"))))

-- 
Anthony Carrico
http://memebeam.org/acarrico/

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]