[ENH]MorphicPerformance1-efc

Eddie Cottongim cottonsqueak at earthlink.net
Sat Aug 6 18:49:23 UTC 2005


I thought I would group some of these optimizations together so it would 
be easier to keep track of. Here is the first grouping I have come up 
with before I leave on vacation and quit bugging everybody. The work on 
the explorer windows is going to have to wait because it touches too 
many things.

Benchmarks follow. Please let me know if you have any problems.

I hope this is helpful.
Thanks,
Eddie

 From Preamble:
"Change Set:        MorphicPerformance1-efc
Date:            6 August 2005
Author:            Eddie Cottongim

Three Morphic performance improvements:

-LazyLists seem to have a problem where they are not being lazy enough. 
#hUnadjustedScrollRange seemed to be forcing the installation of the 
entire list (I am not sure exactly why) thus negating the lazy quality. 
The method was also pretty slow and getting called a lot while 
scrolling. I've simplified the method and added a cache for this value.

-StrikeFontSet has been optimized to use the bitblt text primitive for 
bytestrings. For the multibyte path, it was still possible to save a few 
sends for a noticable improvement.

-Change Morph>>submorphs to be non-copying. This seems to be the 
concensus on the squeak-dev list of the right thing to do. It doesn't 
provide a noticable boost in normal circumstances but with very large 
numbers of morphs it prevents a lot of scaling problems.

The overall impact is about 20% on the 10Browers test, about double the 
single byte text printing speed, and a 10-15% improvement on the 
multibyte string printing.

"

One note on font things, it seems to be a weird situation with 
StrikeFontSet/StrikeFont, so I only touched the paths that were getting 
hit a lot.

Oh, also I'm having a math impairment moment, my % improvements might be 
off a bit.

Benchmark results, lower is better: (Code follows)

10Browser test:                (improvement)
    3.8 base:    9574.2
    MP1:        7587.2            ~20%
With the ST-80 Theme:
    3.8 base    4584.2           
    MP1        4024.4             ~12%
With Squeak 2.8:   (reality check only)
    2.8 base:    1565.6

Text printing:

singlebyte
    3.8 base:    4609
    MP1:         2073    ~50%
multi
    3.8 base:    4906
    MP1:         4227     ~13%



Code for 10Browers: (Thanks to Dan Ingalls)

time _ 0.
saveMorphs _ self currentWorld submorphs.
5 timesRepeat:[
self currentWorld removeAllMorphs.  "heh, heh"
time _ time + (Time millisecondsToRun:
[
    1 to: 10 do: [:i | Browser fullOnClass: SystemDictionary selector: 
#abandonSources].
    self currentWorld submorphs do: [:m | m delete. self currentWorld 
doOneCycle]]).
].
self currentWorld addAllMorphs: saveMorphs.
time/5 asFloat "print it"

Code for text printing: (Stolen from FontTest)

    text := '012345678012345678990123456789' asText.
    font := TextStyle default fontOfSize: 21.
    width _ font widthOfStringOrText: text.
    text addAttribute: (TextFontReference toFont: font).
    bb := (Form extent: width @ 30) getCanvas privatePort.
    bb combinationRule: Form paint.

    font installOn: bb foregroundColor: Color black backgroundColor: 
Color white.
   
    Time millisecondsToRun:[
    10000 timesRepeat: [
        destPoint := font displayString: text on: bb from: 1 to: 30 at: 
0 at 0 kern: 1.
    ].
    ].  "print it"

    "This postamble is useful to see if the test actually worked as 
opposed to just being fast..."
    width := text inject: 0 into: [:max :char | max + (font widthOf: char)].
    bb destForm asMorph openInHand. an ImageMorph(675)




-------------- next part --------------
A non-text attachment was scrubbed...
Name: MorphicPerformance1-efc.3.cs.gz
Type: application/octet-stream
Size: 2197 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20050806/5cd25ca3/MorphicPerformance1-efc.3.cs.obj


More information about the Squeak-dev mailing list