Hi Igor it would be good to see how the new text model perform. Stef Begin forwarded message:
From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Subject: Fwd: Small text composition bench Date: October 10, 2013 10:46:42 PM GMT+02:00 To: Stéphane Ducasse <stephane.ducasse@inria.fr>
---------- Forwarded message ---------- From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Date: 2013/10/10 Subject: Small text composition bench To: The general-purpose Squeak developers list <squeak-dev@lists.squeakfoundation.org>
Here is a simple bench:
(StringHolder new contents: (Compiler evaluate: (FileStream fileNamed: 'text.st') contentsOfEntireFile )) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorphPlus] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(NewParagraph new) compose: tm text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Before our changes: 162 ms After our changes: 95 ms And my Pharo 3.0 (#30417) (not up to date) : 364 ms
The main gain is avoiding - the stopConditions copy - and the TextStopConditions indirection - and of course the Multi* when not necessary (Pharo does not)
Here is the test for Pharo variant:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . (StringHolder new contents: text) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorph] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(Paragraph new) compose: text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Me too. What exactly doing this code? Paragraph new compose: tm text style: tm textStyle copy from: 1 in: Is it layout building stuff at new text model? 2013/10/11 Stéphane Ducasse <stephane.ducasse@inria.fr>
Hi Igor
it would be good to see how the new text model perform.
Stef
Begin forwarded message:
*From: *Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> *Subject: **Fwd: Small text composition bench* *Date: *October 10, 2013 10:46:42 PM GMT+02:00 *To: *Stéphane Ducasse <stephane.ducasse@inria.fr>
---------- Forwarded message ---------- From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Date: 2013/10/10 Subject: Small text composition bench To: The general-purpose Squeak developers list < squeak-dev@lists.squeakfoundation.org>
Here is a simple bench:
(StringHolder new contents: (Compiler evaluate: (FileStream fileNamed: ' text.st') contentsOfEntireFile )) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorphPlus] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(NewParagraph new) compose: tm text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Before our changes: 162 ms After our changes: 95 ms And my Pharo 3.0 (#30417) (not up to date) : 364 ms
The main gain is avoiding - the stopConditions copy - and the TextStopConditions indirection - and of course the Multi* when not necessary (Pharo does not)
Here is the test for Pharo variant:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . (StringHolder new contents: text) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorph] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(Paragraph new) compose: text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
I do not know I could not find a squeak image with the latest code and the update is not working from the june image. Now the newtext model should replace all that but still - we need to benchmark it - release it Stef
Me too.
What exactly doing this code?
Paragraph new compose: tm text style: tm textStyle copy from: 1 in:
Is it layout building stuff at new text model?
2013/10/11 Stéphane Ducasse <stephane.ducasse@inria.fr> Hi Igor
it would be good to see how the new text model perform.
Stef
Begin forwarded message:
From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Subject: Fwd: Small text composition bench Date: October 10, 2013 10:46:42 PM GMT+02:00 To: Stéphane Ducasse <stephane.ducasse@inria.fr>
---------- Forwarded message ---------- From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Date: 2013/10/10 Subject: Small text composition bench To: The general-purpose Squeak developers list <squeak-dev@lists.squeakfoundation.org>
Here is a simple bench:
(StringHolder new contents: (Compiler evaluate: (FileStream fileNamed: 'text.st') contentsOfEntireFile )) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorphPlus] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(NewParagraph new) compose: tm text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Before our changes: 162 ms After our changes: 95 ms And my Pharo 3.0 (#30417) (not up to date) : 364 ms
The main gain is avoiding - the stopConditions copy - and the TextStopConditions indirection - and of course the Multi* when not necessary (Pharo does not)
Here is the test for Pharo variant:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . (StringHolder new contents: text) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorph] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(Paragraph new) compose: text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
http://build.squeak.org/ is your best bet. Grab from the SqueakTrunk job's last successful build. frank On 11 Oct 2013, at 8:09, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
I do not know I could not find a squeak image with the latest code and the update is not working from the june image. Now the newtext model should replace all that but still - we need to benchmark it - release it Stef
Me too.
What exactly doing this code?
Paragraph new compose: tm text style: tm textStyle copy from: 1 in:
Is it layout building stuff at new text model?
2013/10/11 Stéphane Ducasse <stephane.ducasse@inria.fr> Hi Igor
it would be good to see how the new text model perform.
Stef
Begin forwarded message:
From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Subject: Fwd: Small text composition bench Date: October 10, 2013 10:46:42 PM GMT+02:00 To: Stéphane Ducasse <stephane.ducasse@inria.fr>
---------- Forwarded message ---------- From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Date: 2013/10/10 Subject: Small text composition bench To: The general-purpose Squeak developers list <squeak-dev@lists.squeakfoundation.org>
Here is a simple bench:
(StringHolder new contents: (Compiler evaluate: (FileStream fileNamed: 'text.st') contentsOfEntireFile )) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorphPlus] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(NewParagraph new) compose: tm text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Before our changes: 162 ms After our changes: 95 ms And my Pharo 3.0 (#30417) (not up to date) : 364 ms
The main gain is avoiding - the stopConditions copy - and the TextStopConditions indirection - and of course the Multi* when not necessary (Pharo does not)
Here is the test for Pharo variant:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . (StringHolder new contents: text) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorph] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(Paragraph new) compose: text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Le 11 oct. 2013 à 08:15, Denis Kudriashov <dionisiydk@gmail.com> a écrit :
Me too.
What exactly doing this code?
Paragraph new compose: tm text style: tm textStyle copy from: 1 in:
Is it layout building stuff at new text model?
I think yes. It composes a Text as a collection of TextLine. Alain
2013/10/11 Stéphane Ducasse <stephane.ducasse@inria.fr> Hi Igor
it would be good to see how the new text model perform.
Stef
Begin forwarded message:
From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Subject: Fwd: Small text composition bench Date: October 10, 2013 10:46:42 PM GMT+02:00 To: Stéphane Ducasse <stephane.ducasse@inria.fr>
---------- Forwarded message ---------- From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Date: 2013/10/10 Subject: Small text composition bench To: The general-purpose Squeak developers list <squeak-dev@lists.squeakfoundation.org>
Here is a simple bench:
(StringHolder new contents: (Compiler evaluate: (FileStream fileNamed: 'text.st') contentsOfEntireFile )) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorphPlus] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(NewParagraph new) compose: tm text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Before our changes: 162 ms After our changes: 95 ms And my Pharo 3.0 (#30417) (not up to date) : 364 ms
The main gain is avoiding - the stopConditions copy - and the TextStopConditions indirection - and of course the Multi* when not necessary (Pharo does not)
Here is the test for Pharo variant:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . (StringHolder new contents: text) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorph] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(Paragraph new) compose: text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Hi I discuss with igor and its new design precomputes everything so we will see. What would be good is to have another guy looking at what igor is doing because now that fernando transformed himself in a puff of smoke, igor is alone with me looking at it form time to time. Stef On Oct 11, 2013, at 1:08 PM, plantec <alain.plantec@yahoo.com> wrote:
Le 11 oct. 2013 à 08:15, Denis Kudriashov <dionisiydk@gmail.com> a écrit :
Me too.
What exactly doing this code?
Paragraph new compose: tm text style: tm textStyle copy from: 1 in:
Is it layout building stuff at new text model?
I think yes. It composes a Text as a collection of TextLine. Alain
2013/10/11 Stéphane Ducasse <stephane.ducasse@inria.fr> Hi Igor
it would be good to see how the new text model perform.
Stef
Begin forwarded message:
From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Subject: Fwd: Small text composition bench Date: October 10, 2013 10:46:42 PM GMT+02:00 To: Stéphane Ducasse <stephane.ducasse@inria.fr>
---------- Forwarded message ---------- From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Date: 2013/10/10 Subject: Small text composition bench To: The general-purpose Squeak developers list <squeak-dev@lists.squeakfoundation.org>
Here is a simple bench:
(StringHolder new contents: (Compiler evaluate: (FileStream fileNamed: 'text.st') contentsOfEntireFile )) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorphPlus] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(NewParagraph new) compose: tm text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Before our changes: 162 ms After our changes: 95 ms And my Pharo 3.0 (#30417) (not up to date) : 364 ms
The main gain is avoiding - the stopConditions copy - and the TextStopConditions indirection - and of course the Multi* when not necessary (Pharo does not)
Here is the test for Pharo variant:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . (StringHolder new contents: text) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorph] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(Paragraph new) compose: text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
On 11 oct. 2013, at 20:25, Stéphane Ducasse wrote:
Hi
I discuss with igor and its new design precomputes everything so we will see. What would be good is to have another guy looking at what igor is doing because now that fernando transformed himself in a puff of smoke, igor is alone with me looking at it form time to time.
Me when I come back. We have to work on the editor together anyway.
Stef On Oct 11, 2013, at 1:08 PM, plantec <alain.plantec@yahoo.com> wrote:
Le 11 oct. 2013 à 08:15, Denis Kudriashov <dionisiydk@gmail.com> a écrit :
Me too.
What exactly doing this code?
Paragraph new compose: tm text style: tm textStyle copy from: 1 in:
Is it layout building stuff at new text model?
I think yes. It composes a Text as a collection of TextLine. Alain
2013/10/11 Stéphane Ducasse <stephane.ducasse@inria.fr> Hi Igor
it would be good to see how the new text model perform.
Stef
Begin forwarded message:
From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Subject: Fwd: Small text composition bench Date: October 10, 2013 10:46:42 PM GMT+02:00 To: Stéphane Ducasse <stephane.ducasse@inria.fr>
---------- Forwarded message ---------- From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Date: 2013/10/10 Subject: Small text composition bench To: The general-purpose Squeak developers list <squeak-dev@lists.squeakfoundation.org>
Here is a simple bench:
(StringHolder new contents: (Compiler evaluate: (FileStream fileNamed: 'text.st') contentsOfEntireFile )) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorphPlus] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(NewParagraph new) compose: tm text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Before our changes: 162 ms After our changes: 95 ms And my Pharo 3.0 (#30417) (not up to date) : 364 ms
The main gain is avoiding - the stopConditions copy - and the TextStopConditions indirection - and of course the Multi* when not necessary (Pharo does not)
Here is the test for Pharo variant:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . (StringHolder new contents: text) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorph] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(Paragraph new) compose: text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
OK Igor, I loaded ConfigurationOfTxText and I understand what you say: - TxText spend more time in composing layout because it records each and every TxSpanInterval - this will later accelerate display, because no scanning is required at display time On the base that you compose once and display many, this is a Memory/CPU trading that would not have been a good idea the 70's (birth of CharacterScanner family), but is now fair. Even if that does not make much sense, composition (layout building) can be measured with this kind of mini bench: | text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . MessageTally spyOn: [[100 timesRepeat: [(Paragraph new) compose: text style: TextStyle default copy from: 1 in: ( 0@0 corner: 569@9999999)]] timeToRun ]. MessageTally spyOn: [ 100 timesRepeat: [| m | m := TxTextMorph new. m layoutStrategy: TxWrapTextStrategy new. m extent: 569@9999999. m newTextContents: text]] 95ms in revised Squeak CompositionScanner / 366ms Pharo MultiCcompositionScanner / 347ms TxText I'll try to write a mini bench to measure display only on a Form with StrikeFont and BitBlt... 2013/10/11 Camille Teruel <camille.teruel@gmail.com>
On 11 oct. 2013, at 20:25, Stéphane Ducasse wrote:
Hi
I discuss with igor and its new design precomputes everything so we will see. What would be good is to have another guy looking at what igor is doing because now that fernando transformed himself in a puff of smoke, igor is alone with me looking at it form time to time.
Me when I come back. We have to work on the editor together anyway.
Stef On Oct 11, 2013, at 1:08 PM, plantec <alain.plantec@yahoo.com> wrote:
Le 11 oct. 2013 Ã 08:15, Denis Kudriashov <dionisiydk@gmail.com> a
écrit :
Me too.
What exactly doing this code?
Paragraph new compose: tm text style: tm textStyle copy from: 1 in:
Is it layout building stuff at new text model?
I think yes. It composes a Text as a collection of TextLine. Alain
2013/10/11 Stéphane Ducasse <stephane.ducasse@inria.fr> Hi Igor
it would be good to see how the new text model perform.
Stef
Begin forwarded message:
From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Subject: Fwd: Small text composition bench Date: October 10, 2013 10:46:42 PM GMT+02:00 To: Stéphane Ducasse <stephane.ducasse@inria.fr>
---------- Forwarded message ---------- From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Date: 2013/10/10 Subject: Small text composition bench To: The general-purpose Squeak developers list <
squeak-dev@lists.squeakfoundation.org>
Here is a simple bench:
(StringHolder new contents: (Compiler evaluate: (FileStream
fileNamed: 'text.st') contentsOfEntireFile )) openLabel: 'Working With Squeak 2' .
((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorphPlus] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(NewParagraph new) compose: tm text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Before our changes: 162 ms After our changes: 95 ms And my Pharo 3.0 (#30417) (not up to date) : 364 ms
The main gain is avoiding - the stopConditions copy - and the TextStopConditions indirection - and of course the Multi* when not necessary (Pharo does not)
Here is the test for Pharo variant:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . (StringHolder new contents: text) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorph] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(Paragraph new) compose: text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
So here is the display mini bench: | text canvas m1 m2 | canvas := FormCanvas extent: 569@399 depth: 32. text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . m1 := TextMorph new. m1 text: text textStyle: TextStyle default. m1 wrapFlag: true. m1 extent: 569@9999999. MessageTally spyOn: [ 100 timesRepeat: [ m1 drawOn: canvas]]. m2 := TxTextMorph new. m2 layoutStrategy: TxWrapTextStrategy new. m2 extent: 569@9999999. m2 newTextContents: text. MessageTally spyOn: [ 100 timesRepeat: [ m2 drawOn: canvas]]. Squeak revised BitBltDisplayScanner 1077ms / Pharo MultiDisplayScanner 1229ms / Pharo TxText 1584ms But the tallies does not make sense, we should better use Andreas tallying... 2013/10/11 Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com>
OK Igor, I loaded ConfigurationOfTxText and I understand what you say: - TxText spend more time in composing layout because it records each and every TxSpanInterval - this will later accelerate display, because no scanning is required at display time On the base that you compose once and display many, this is a Memory/CPU trading that would not have been a good idea the 70's (birth of CharacterScanner family), but is now fair.
Even if that does not make much sense, composition (layout building) can be measured with this kind of mini bench:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . MessageTally spyOn: [[100 timesRepeat: [(Paragraph new) compose: text style: TextStyle default copy from: 1 in: ( 0@0 corner: 569@9999999)]] timeToRun ]. MessageTally spyOn: [ 100 timesRepeat: [| m | m := TxTextMorph new. m layoutStrategy: TxWrapTextStrategy new. m extent: 569@9999999. m newTextContents: text]]
95ms in revised Squeak CompositionScanner / 366ms Pharo MultiCcompositionScanner / 347ms TxText
I'll try to write a mini bench to measure display only on a Form with StrikeFont and BitBlt...
2013/10/11 Camille Teruel <camille.teruel@gmail.com>
On 11 oct. 2013, at 20:25, Stéphane Ducasse wrote:
Hi
I discuss with igor and its new design precomputes everything so we will see. What would be good is to have another guy looking at what igor is doing because now that fernando transformed himself in a puff of smoke, igor is alone with me looking at it form time to time.
Me when I come back. We have to work on the editor together anyway.
Stef On Oct 11, 2013, at 1:08 PM, plantec <alain.plantec@yahoo.com> wrote:
Le 11 oct. 2013 Ã 08:15, Denis Kudriashov <dionisiydk@gmail.com> a
écrit :
Me too.
What exactly doing this code?
Paragraph new compose: tm text style: tm textStyle copy from: 1 in:
Is it layout building stuff at new text model?
I think yes. It composes a Text as a collection of TextLine. Alain
2013/10/11 Stéphane Ducasse <stephane.ducasse@inria.fr> Hi Igor
it would be good to see how the new text model perform.
Stef
Begin forwarded message:
From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Subject: Fwd: Small text composition bench Date: October 10, 2013 10:46:42 PM GMT+02:00 To: Stéphane Ducasse <stephane.ducasse@inria.fr>
---------- Forwarded message ---------- From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Date: 2013/10/10 Subject: Small text composition bench To: The general-purpose Squeak developers list <
squeak-dev@lists.squeakfoundation.org>
Here is a simple bench:
(StringHolder new contents: (Compiler evaluate: (FileStream
fileNamed: 'text.st') contentsOfEntireFile )) openLabel: 'Working With Squeak 2' .
((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorphPlus] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(NewParagraph new) compose: tm text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Before our changes: 162 ms After our changes: 95 ms And my Pharo 3.0 (#30417) (not up to date) : 364 ms
The main gain is avoiding - the stopConditions copy - and the TextStopConditions indirection - and of course the Multi* when not necessary (Pharo does not)
Here is the test for Pharo variant:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . (StringHolder new contents: text) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorph] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(Paragraph new) compose: text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Thanks Nicolas.
So here is the display mini bench:
| text canvas m1 m2 | canvas := FormCanvas extent: 569@399 depth: 32. text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . m1 := TextMorph new. m1 text: text textStyle: TextStyle default. m1 wrapFlag: true. m1 extent: 569@9999999. MessageTally spyOn: [ 100 timesRepeat: [ m1 drawOn: canvas]]. m2 := TxTextMorph new. m2 layoutStrategy: TxWrapTextStrategy new. m2 extent: 569@9999999. m2 newTextContents: text. MessageTally spyOn: [ 100 timesRepeat: [ m2 drawOn: canvas]].
Squeak revised BitBltDisplayScanner 1077ms / Pharo MultiDisplayScanner 1229ms / Pharo TxText 1584ms
But the tallies does not make sense, we should better use Andreas tallying...
2013/10/11 Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> OK Igor, I loaded ConfigurationOfTxText and I understand what you say: - TxText spend more time in composing layout because it records each and every TxSpanInterval - this will later accelerate display, because no scanning is required at display time On the base that you compose once and display many, this is a Memory/CPU trading that would not have been a good idea the 70's (birth of CharacterScanner family), but is now fair.
Even if that does not make much sense, composition (layout building) can be measured with this kind of mini bench:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . MessageTally spyOn: [[100 timesRepeat: [(Paragraph new) compose: text style: TextStyle default copy from: 1 in: ( 0@0 corner: 569@9999999)]] timeToRun ]. MessageTally spyOn: [ 100 timesRepeat: [| m | m := TxTextMorph new. m layoutStrategy: TxWrapTextStrategy new. m extent: 569@9999999. m newTextContents: text]]
95ms in revised Squeak CompositionScanner / 366ms Pharo MultiCcompositionScanner / 347ms TxText
I'll try to write a mini bench to measure display only on a Form with StrikeFont and BitBlt...
2013/10/11 Camille Teruel <camille.teruel@gmail.com>
On 11 oct. 2013, at 20:25, Stéphane Ducasse wrote:
Hi
I discuss with igor and its new design precomputes everything so we will see. What would be good is to have another guy looking at what igor is doing because now that fernando transformed himself in a puff of smoke, igor is alone with me looking at it form time to time.
Me when I come back. We have to work on the editor together anyway.
Stef On Oct 11, 2013, at 1:08 PM, plantec <alain.plantec@yahoo.com> wrote:
Le 11 oct. 2013 à 08:15, Denis Kudriashov <dionisiydk@gmail.com> a écrit :
Me too.
What exactly doing this code?
Paragraph new compose: tm text style: tm textStyle copy from: 1 in:
Is it layout building stuff at new text model?
I think yes. It composes a Text as a collection of TextLine. Alain
2013/10/11 Stéphane Ducasse <stephane.ducasse@inria.fr> Hi Igor
it would be good to see how the new text model perform.
Stef
Begin forwarded message:
From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Subject: Fwd: Small text composition bench Date: October 10, 2013 10:46:42 PM GMT+02:00 To: Stéphane Ducasse <stephane.ducasse@inria.fr>
---------- Forwarded message ---------- From: Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> Date: 2013/10/10 Subject: Small text composition bench To: The general-purpose Squeak developers list <squeak-dev@lists.squeakfoundation.org>
Here is a simple bench:
(StringHolder new contents: (Compiler evaluate: (FileStream fileNamed: 'text.st') contentsOfEntireFile )) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorphPlus] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(NewParagraph new) compose: tm text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
Before our changes: 162 ms After our changes: 95 ms And my Pharo 3.0 (#30417) (not up to date) : 364 ms
The main gain is avoiding - the stopConditions copy - and the TextStopConditions indirection - and of course the Multi* when not necessary (Pharo does not)
Here is the test for Pharo variant:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . (StringHolder new contents: text) openLabel: 'Working With Squeak 2' . ((SystemWindow allSubInstances detect: [:e | e label = 'Working With Squeak 2']) findDeepSubmorphThat: [:m | m class = PluggableTextMorph] ifAbsent: [] ) textMorph ifNotNil: [:tm | MessageTally spyOn: [ [100 timesRepeat: [(Paragraph new) compose: text style: tm textStyle copy from: 1 in: tm container]] timeToRun]].
2013/10/12 Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com>
So here is the display mini bench:
| text canvas m1 m2 | canvas := FormCanvas extent: 569@399 depth: 32.
text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . m1 := TextMorph new. m1 text: text textStyle: TextStyle default. m1 wrapFlag: true. m1 extent: 569@9999999. MessageTally spyOn: [ 100 timesRepeat: [ m1 drawOn: canvas]]. m2 := TxTextMorph new. m2 layoutStrategy: TxWrapTextStrategy new. m2 extent: 569@9999999. m2 newTextContents: text. MessageTally spyOn: [ 100 timesRepeat: [ m2 drawOn: canvas]].
Squeak revised BitBltDisplayScanner 1077ms / Pharo MultiDisplayScanner 1229ms / Pharo TxText 1584ms
Interesting how Athens drawing will change picture
On 12 October 2013 09:28, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2013/10/12 Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com>
So here is the display mini bench:
| text canvas m1 m2 | canvas := FormCanvas extent: 569@399 depth: 32.
text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . m1 := TextMorph new. m1 text: text textStyle: TextStyle default. m1 wrapFlag: true. m1 extent: 569@9999999. MessageTally spyOn: [ 100 timesRepeat: [ m1 drawOn: canvas]]. m2 := TxTextMorph new. m2 layoutStrategy: TxWrapTextStrategy new. m2 extent: 569@9999999. m2 newTextContents: text. MessageTally spyOn: [ 100 timesRepeat: [ m2 drawOn: canvas]].
Squeak revised BitBltDisplayScanner 1077ms / Pharo MultiDisplayScanner 1229ms / Pharo TxText 1584ms
Interesting how Athens drawing will change picture
i hoping for the better. i did many changes comparing to your original code, and need to do some cleanup. In athens to calculate layout i introduced a special role called "font metrics provider" , which is responsible for calculating dimensions of separate glyphs and advance. Right now it is hardcoded to use CairoFontMetricsProvider, but later it going to be refurbished and merged with CairoFreetypeFontRenderer. So you will be able to obtain one using: fontRenderer := canvas setFont: aFont. or: fontRenderer := aFont glyphRendererOn: surface. and once you got it, you can ask certain things from it: fontRenderer getGlyphWidth: aCharacter fontRenderer fontAscent fontRenderer fontHeight etc but it is not fully organically merged yet, and need more thought what is public API of it to cover the needs of rendering text and/or measuring it. -- Best regards, Igor Stasenko.
Hi 2013/10/12 Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com>
OK Igor, I loaded ConfigurationOfTxText and I understand what you say: - TxText spend more time in composing layout because it records each and every TxSpanInterval - this will later accelerate display, because no scanning is required at display time On the base that you compose once and display many, this is a Memory/CPU trading that would not have been a good idea the 70's (birth of CharacterScanner family), but is now fair.
Even if that does not make much sense, composition (layout building) can be measured with this kind of mini bench:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . MessageTally spyOn: [[100 timesRepeat: [(Paragraph new) compose: text style: TextStyle default copy from: 1 in: ( 0@0 corner: 569@9999999)]] timeToRun ]. MessageTally spyOn: [ 100 timesRepeat: [| m | m := TxTextMorph new. m layoutStrategy: TxWrapTextStrategy new. m extent: 569@9999999. m newTextContents: text]]
95ms in revised Squeak CompositionScanner / 366ms Pharo MultiCcompositionScanner / 347ms TxText
I think it is not correct code for TxText. "text" variable contains Text instance which should be converted to TxModel first. TxModel is replacement of Text in TxText. So my benches shows that TxText works better in Pharo: text := Compiler evaluate: (FileSystem workingDirectory / 'text.st' ) readStream contentsOfEntireFile . [100 timesRepeat: [(Paragraph new) compose: text style: TextStyle default copy from: 1 in: ( 0@0 corner: 569@9999999)]] timeToRun . 236. txModel := TxModel new. cursor := txModel startSpan startPosition. cursor insert: text. [ 100 timesRepeat: [| m | m := TxTextMorph new. m layoutStrategy: TxWrapTextStrategy new. m extent: 569@9999999. m textModel: txModel]] timeToRun. 145. [ 100 timesRepeat: [| m | m := TxTextMorph new. m layoutStrategy: TxNativeLayoutStrategy new. "without wrapping" m extent: 569@9999999. m textModel: txModel]] timeToRun. 118 . But Squeak is champion: [100 timesRepeat: [(NewParagraph new) compose: text style: TextStyle default copy from: 1 in: ( 0@0 corner: 569@9999999)]] timeToRun . 84. Best regards, Denis
Ah, thanks Denis, my first look was too superficial. I must also load a more recent version (I started with Igor's 1.0). 2013/10/12 Denis Kudriashov <dionisiydk@gmail.com>
Hi
2013/10/12 Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com>
OK Igor, I loaded ConfigurationOfTxText and I understand what you say: - TxText spend more time in composing layout because it records each and every TxSpanInterval - this will later accelerate display, because no scanning is required at display time On the base that you compose once and display many, this is a Memory/CPU trading that would not have been a good idea the 70's (birth of CharacterScanner family), but is now fair.
Even if that does not make much sense, composition (layout building) can be measured with this kind of mini bench:
| text | text := Compiler evaluate: (FileSystem workingDirectory parent parent parent / 'text.st' ) readStream contentsOfEntireFile . MessageTally spyOn: [[100 timesRepeat: [(Paragraph new) compose: text style: TextStyle default copy from: 1 in: ( 0@0 corner: 569@9999999)]] timeToRun ]. MessageTally spyOn: [ 100 timesRepeat: [| m | m := TxTextMorph new. m layoutStrategy: TxWrapTextStrategy new. m extent: 569@9999999. m newTextContents: text]]
95ms in revised Squeak CompositionScanner / 366ms Pharo MultiCcompositionScanner / 347ms TxText
I think it is not correct code for TxText. "text" variable contains Text instance which should be converted to TxModel first. TxModel is replacement of Text in TxText.
So my benches shows that TxText works better in Pharo:
text := Compiler evaluate: (FileSystem workingDirectory / 'text.st' ) readStream contentsOfEntireFile .
[100 timesRepeat: [(Paragraph new) compose: text style: TextStyle default copy from: 1 in: ( 0@0 corner: 569@9999999)]] timeToRun . 236.
txModel := TxModel new. cursor := txModel startSpan startPosition. cursor insert: text.
[ 100 timesRepeat: [| m | m := TxTextMorph new. m layoutStrategy: TxWrapTextStrategy new. m extent: 569@9999999. m textModel: txModel]] timeToRun. 145.
[ 100 timesRepeat: [| m | m := TxTextMorph new. m layoutStrategy: TxNativeLayoutStrategy new. "without wrapping" m extent: 569@9999999. m textModel: txModel]] timeToRun. 118 .
But Squeak is champion:
[100 timesRepeat: [(NewParagraph new) compose: text style: TextStyle default copy from: 1 in: ( 0@0 corner: 569@9999999)]] timeToRun . 84.
Best regards, Denis
On 11 October 2013 07:34, Stéphane Ducasse <stephane.ducasse@inria.fr>wrote:
Hi Igor
it would be good to see how the new text model perform.
Thanks.. Rough equivalent of it in new text model would be: ======= morph := (TxTextEditorMorph openInWindowWithString: '=Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC =Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC =Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC ') submorphs last submorphs last. layoutView := morph instVarNamed: #layoutViewMorph. [100 timesRepeat: [ layoutView resetLayout ]] timeToRun 0:00:00:00.006 but that comparison don't have much sense, because the layout & rendering is different. First, because in reality, the layout is not calculated each time when view is rendered, but only when the view changed or text changed. Second, the layout is calculated only for portion of text (big enough to correctly display the text in view), and thus, depending mostly just on view extent, in contrast to old model, which depends mostly on text size itself. The rendering uses precalculated layout and highly depends on what font/resolution etc is used... So, for more fair comparison, i'd better compare the rendering speed, because at the end it is up (or down) to the "how fast you can deliver text on screen". -- Best regards, Igor Stasenko.
participants (7)
-
Camille Teruel -
Denis Kudriashov -
Frank Shearar -
Igor Stasenko -
Nicolas Cellier -
plantec -
Stéphane Ducasse