I'm using Pharo 2, a build one month old as much.

Date (Timespan)>>#= comparand
^ self species = comparand species
and: [ self start = comparand start "start is a DateAndTime"
and: [ self duration = comparand duration ]]

DateAndTime>>#= other
self == other ifTrue: [ ^ true ].
(self species = other species) ifFalse: [ ^ false ].
^ self asSeconds = other asSeconds and: [ self nanoSecond = other nanoSecond ]

And the culprit (I guess):

DateAndTime>>#asSeconds
  "Return the number of seconds since the Squeak epoch"

  ^ (self - (self class epoch)) asSeconds

DateAndTime's class #epoch instantiates two DateAndTimes, one for
julianDayNumber zero, and then other for the offset:
DateAndTime class>>#epoch
  "Answer a DateAndTime representing the Squeak epoch: 1 January 1901"

  ^ (self julianDayNumber: SqueakEpoch) offset: 0.

The #asSeconds also incur in DateAndTime subtraction (operand #-),
which doesn't seem to be tuned for performance either.


Best regards!


Esteban A. Maringolo

Reply via email to