SYSTEM WARNING: Creating default object from empty value

Mantis - Squeak
Viewing Issue Advanced Details
4669 Kernel minor always 08-31-06 02:22 12-01-08 23:36
closed 3.8  
none 3.10  
0004669: [ENH] TimeForSpeed
Ok, so we were trying to figure out why our logger in Gjallar spent so much time in creating DateAndTime etc... after looking, tweaking, profiling and even some thinking I came up with this "SpeedPack" of changes.

I might have broken some subtleties (I don't think I have though) but the tests are still green. Glad for any indepth review.

And? Well, the speed differences are quite huge. :) Lots of it comes from better Duration instance creation methods and from not going back and forth too much between nanos and seconds etc.

"DateAndTime now" is about 6 times faster and "Date today" 4 times. The full chronology test suite runs almost 2 times faster. See preamble for a do-it that shows this (run before and after installing cs).

So far only tested in 3.8.
related to 0000474closed KenCausey [BUG][FIX] accurateDateAndTimeNow-brp 
related to 0007356closed lewis DateAndTime fromSeconds: 0.5 => walkback, broken since Mantis 4669 
 TimeForSpeed-gk.1.cs.gz [^] (2,734 bytes) 08-31-06 02:22
 fasterDayOfYear-brp.1.cs.gz [^] (825 bytes) 08-31-06 14:06
 before.png [^] (10,202 bytes) 11-23-07 10:04
 after.png [^] (10,325 bytes) 11-23-07 10:05

08-31-06 14:06   
I am nominally responsible for the Chronology package since I wrote it :)

I have tested and reviewed this change. All tests pass in 3.8.1 (6744).

I would also encourage this enhancement to include Dan Ingall's modificaton
which significantly speeds up printing a DateAndTime instance. All tests work with both enhancements. I have attached my cleanup of Dan's code to this issue.

    suite := TestSuite new name: 'Chronology Tests'.
    (SystemOrganization superclassOrder: #'Kernel-Chronology-Tests')
        do: [ :tc | tc addToSuiteFromSelectors: suite ].
    suite run.

420 run, 420 passes, 0 expected failures, 0 failures, 0 errors...

I strongly encourage both changesets to be approved.
11-23-07 10:04   
Tested in Squeak3.10.1beta.7155.image .
In a workspace I put this slight changed test from Goran, press tallyIt.

| suite |
Smalltalk garbageCollect.
result _ {
    [10000 timesRepeat: [Date today]] timeToRun.
    [10000 timesRepeat: [DateAndTime now]] timeToRun.
    [10000 timesRepeat: [DateAndTime year: 2000 day: 120]] timeToRun.
    [10000 timesRepeat: [Duration weeks: 1]] timeToRun.
    [10000 timesRepeat: [Duration milliSeconds: 1]] timeToRun.
    [10000 timesRepeat: [(Duration seconds: 10 nanoSeconds: 1) ticks]] timeToRun.
} asOrderedCollection.
suite _ TestSuite new name: 'Chronology tests'.
(SystemOrganization superclassOrder: #'KernelTests-Chronology') remove: StopwatchTest;
    do: [:c | c addToSuiteFromSelectors: suite ].
suite tests remove: (suite tests detect: [:e | e selector = #testMonotonicity ]).
result add: [10 timesRepeat: [suite run]] timeToRun.

I put the picts here. 3 to one speedUp is very good
Doing 7156 update for 3.10. Thanks people !

12-01-08 23:36   
Harvested as update 7156 and released in Squeak 3.10.