using athens fonts is dead slow in roassal

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

using athens fonts is dead slow in roassal

Tudor Girba-2
Hi,

Try this:
[view := ROMondrianViewBuilder new.
view shape label fontSize: [:x | x ].
view nodes: (10 to: 100).
view open] timeToRun  

On my MacBookPro i7 2.6 GHz this takes 23s.

The actual reason is that LogicalFont>>widthOfString: looks up the real font when the font is not yet cached. And this ends up looking for files on the disk.

I do not know an easy way out, but as it is, we cannot use font scaling essentially. And because of that, visualizations like Annotation Constellation are not practicable anymore:

Cheers,
Doru

--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: using athens fonts is dead slow in roassal

Stéphane Ducasse
Igor is working out on textEditor with fernando and they are making progress. 
I know that igor want to build a cache for fonts and that now he changed the API of Cairo because the previous one was making approximations that led to 
problems when zooming (and then to identify character under the mouse).
Now I do not know how and if it will have an impact (probably on this one).
One objectives is also to see how to reuse some of the morphs made on top of Rubric (but not rubric because it is based on the old and bad paragraph editor).

Stef

Hi,

Try this:
[view := ROMondrianViewBuilder new.
view shape label fontSize: [:x | x ].
view nodes: (10 to: 100).
view open] timeToRun  

On my MacBookPro i7 2.6 GHz this takes 23s.

The actual reason is that LogicalFont>>widthOfString: looks up the real font when the font is not yet cached. And this ends up looking for files on the disk.

I do not know an easy way out, but as it is, we cannot use font scaling essentially. And because of that, visualizations like Annotation Constellation are not practicable anymore:

Cheers,
Doru

--

"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: using athens fonts is dead slow in roassal

Ben Coman
In reply to this post by Tudor Girba-2
Hi Doru,

On Windows 7 this comes up instantaneously.  Freshly downloaded Moose 48 image and Pharo 20 vm.

cheers, Ben

Tudor Girba wrote:
Hi,

Try this:
[view := ROMondrianViewBuilder new.
view shape label fontSize: [:x | x ].
view nodes: (10 to: 100).
view open] timeToRun

On my MacBookPro i7 2.6 GHz this takes 23s.

The actual reason is that LogicalFont>>widthOfString: looks up the real
font when the font is not yet cached. And this ends up looking for files on
the disk.

I do not know an easy way out, but as it is, we cannot use font scaling
essentially. And because of that, visualizations like Annotation
Constellation are not practicable anymore:
http://www.themoosebook.org/book/externals/visualizations/annotation-constellation

Cheers,
Doru

  

_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: using athens fonts is dead slow in roassal

Tudor Girba-2
I forgot to mention that you have to install Athens first before executing the example:

MooseImageSetupCommandLineHandler new 
installFonts;
installAthens

Cheers,
Doru


On Sat, Aug 24, 2013 at 1:14 AM, Ben Coman <[hidden email]> wrote:
Hi Doru,

On Windows 7 this comes up instantaneously.  Freshly downloaded Moose 48 image and Pharo 20 vm.

cheers, Ben

Tudor Girba wrote:
Hi,

Try this:
[view := ROMondrianViewBuilder new.
view shape label fontSize: [:x | x ].
view nodes: (10 to: 100).
view open] timeToRun

On my MacBookPro i7 2.6 GHz this takes 23s.

The actual reason is that LogicalFont>>widthOfString: looks up the real
font when the font is not yet cached. And this ends up looking for files on
the disk.

I do not know an easy way out, but as it is, we cannot use font scaling
essentially. And because of that, visualizations like Annotation
Constellation are not practicable anymore:
http://www.themoosebook.org/book/externals/visualizations/annotation-constellation

Cheers,
Doru

  

_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: using athens fonts is dead slow in roassal

Tudor Girba-2
In reply to this post by Stéphane Ducasse
Indeed, the issue we have is related to real font caching. It would be great to get a working solution for this. I guess this will not be available in Pharo 2.0 (it would make sense to focus on Pharo 3.0), but maybe we can get some hints as to how to build a little workaround.

I would like to release the Moose 4.8 image with Athens enabled, but I am not sure it's a good idea with this little issue inside.

Doru


On Fri, Aug 23, 2013 at 10:58 PM, Stéphane Ducasse <[hidden email]> wrote:
Igor is working out on textEditor with fernando and they are making progress. 
I know that igor want to build a cache for fonts and that now he changed the API of Cairo because the previous one was making approximations that led to 
problems when zooming (and then to identify character under the mouse).
Now I do not know how and if it will have an impact (probably on this one).
One objectives is also to see how to reuse some of the morphs made on top of Rubric (but not rubric because it is based on the old and bad paragraph editor).

Stef

Hi,

Try this:
[view := ROMondrianViewBuilder new.
view shape label fontSize: [:x | x ].
view nodes: (10 to: 100).
view open] timeToRun  

On my MacBookPro i7 2.6 GHz this takes 23s.

The actual reason is that LogicalFont>>widthOfString: looks up the real font when the font is not yet cached. And this ends up looking for files on the disk.

I do not know an easy way out, but as it is, we cannot use font scaling essentially. And because of that, visualizations like Annotation Constellation are not practicable anymore:

Cheers,
Doru

--

"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: using athens fonts is dead slow in roassal

Tudor Girba-2
Here is more information about the problem: as said, the issue comes from widthOfString:. So, I tested the basic infrastructure:

[10 to: 100 do: [ :x |
(LogicalFont familyName: 'Arial' pointSize: x)
widthOfString: 'test' ]] timeToRun

This one gets ==> 5s

So, where are the rest of the 20s being spent in Roassal? Essentially, given that Roassal will get a new logical font instance every time it tries to display, it essentially slows down everything in the image when multiple fonts are displayed.

I think we should find a way to cache the logical fonts in ROFontOrganizerAthens, or at least to provide the ability to set the font from outside in ROAbstractLabel (rather than just provide the font size).

Cheers,
Doru





On Sat, Aug 24, 2013 at 9:34 AM, Tudor Girba <[hidden email]> wrote:
Indeed, the issue we have is related to real font caching. It would be great to get a working solution for this. I guess this will not be available in Pharo 2.0 (it would make sense to focus on Pharo 3.0), but maybe we can get some hints as to how to build a little workaround.

I would like to release the Moose 4.8 image with Athens enabled, but I am not sure it's a good idea with this little issue inside.

Doru


On Fri, Aug 23, 2013 at 10:58 PM, Stéphane Ducasse <[hidden email]> wrote:
Igor is working out on textEditor with fernando and they are making progress. 
I know that igor want to build a cache for fonts and that now he changed the API of Cairo because the previous one was making approximations that led to 
problems when zooming (and then to identify character under the mouse).
Now I do not know how and if it will have an impact (probably on this one).
One objectives is also to see how to reuse some of the morphs made on top of Rubric (but not rubric because it is based on the old and bad paragraph editor).

Stef

Hi,

Try this:
[view := ROMondrianViewBuilder new.
view shape label fontSize: [:x | x ].
view nodes: (10 to: 100).
view open] timeToRun  

On my MacBookPro i7 2.6 GHz this takes 23s.

The actual reason is that LogicalFont>>widthOfString: looks up the real font when the font is not yet cached. And this ends up looking for files on the disk.

I do not know an easy way out, but as it is, we cannot use font scaling essentially. And because of that, visualizations like Annotation Constellation are not practicable anymore:

Cheers,
Doru

--

"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--

"Every thing has its own flow"



--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: using athens fonts is dead slow in roassal

Ben Coman
After loading Athens, then
[|view|
view := ROMondrianViewBuilder new.
view shape label fontSize: [:x | x ].
view nodes: (10 to: 100).
view open]

timeToRun ---> 4767 msec

By cheating...
LogicalFont>>height
    ^200
LogicalFont>>width
    ^200

then timeToRun ---> 45msec.

With...
LogicalFont>>height
    self realFont "height".
    ^200.

then timeToRun ---> 1929msec.

If I revert the changes above and then do...
LogicalFont>>realFont    
    "Smalltalk at: #btcHack put: Bag new"
    ^realFont ifNil: [
        (Smalltalk at: #btcHack) add: #count.
        realFont := self findRealFont]   ^

then timeToRun --> 4076
and (Smalltalk at: #btcHack) occurrencesOf: #count ---> 587 times it runs #findRealFont.

This might not be the proper place to do caching, but if change this to...
LogicalFont>>realFont
    | cache  |       
    cache := Smalltalk at: #btcHack2 ifAbsentPut: Dictionary new.
    ^realFont ifNil: [ cache at: self printString ifAbsentPut: [ self findRealFont ] ]

then timeToRun --> 1482msec.

cheers, Ben


Tudor Girba wrote:
Here is more information about the problem: as said, the issue comes from
widthOfString:. So, I tested the basic infrastructure:

[10 to: 100 do: [ :x |
(LogicalFont familyName: 'Arial' pointSize: x)
widthOfString: 'test' ]] timeToRun

This one gets ==> 5s

So, where are the rest of the 20s being spent in Roassal? Essentially,
given that Roassal will get a new logical font instance every time it tries
to display, it essentially slows down everything in the image when multiple
fonts are displayed.

I think we should find a way to cache the logical fonts in
ROFontOrganizerAthens, or at least to provide the ability to set the font
from outside in ROAbstractLabel (rather than just provide the font size).

Cheers,
Doru





On Sat, Aug 24, 2013 at 9:34 AM, Tudor Girba [hidden email] wrote:

  
Indeed, the issue we have is related to real font caching. It would be
great to get a working solution for this. I guess this will not be
available in Pharo 2.0 (it would make sense to focus on Pharo 3.0), but
maybe we can get some hints as to how to build a little workaround.

I would like to release the Moose 4.8 image with Athens enabled, but I am
not sure it's a good idea with this little issue inside.

Doru


On Fri, Aug 23, 2013 at 10:58 PM, Stéphane Ducasse <
[hidden email]> wrote:

    
Igor is working out on textEditor with fernando and they are making
progress.
I know that igor want to build a cache for fonts and that now he changed
the API of Cairo because the previous one was making approximations that
led to
problems when zooming (and then to identify character under the mouse).
Now I do not know how and if it will have an impact (probably on this
one).
One objectives is also to see how to reuse some of the morphs made on top
of Rubric (but not rubric because it is based on the old and bad paragraph
editor).

Stef

Hi,

Try this:
[view := ROMondrianViewBuilder new.
view shape label fontSize: [:x | x ].
view nodes: (10 to: 100).
view open] timeToRun

On my MacBookPro i7 2.6 GHz this takes 23s.

The actual reason is that LogicalFont>>widthOfString: looks up the real
font when the font is not yet cached. And this ends up looking for files on
the disk.

I do not know an easy way out, but as it is, we cannot use font scaling
essentially. And because of that, visualizations like Annotation
Constellation are not practicable anymore:

http://www.themoosebook.org/book/externals/visualizations/annotation-constellation

 Cheers,
Doru

--
www.tudorgirba.com

"Every thing has its own flow"
 _______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


      
--
www.tudorgirba.com

"Every thing has its own flow"

    



  

_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: using athens fonts is dead slow in roassal

Tudor Girba-2
I came up with a solution that remains within the bounds of Roassal: cache the font in ROAbstractLabel.

See more details here:

Cheers,
Doru




On Sat, Aug 24, 2013 at 8:40 PM, Ben Coman <[hidden email]> wrote:
After loading Athens, then
[|view|

view := ROMondrianViewBuilder new.
view shape label fontSize: [:x | x ].
view nodes: (10 to: 100).
view open]

timeToRun ---> 4767 msec

By cheating...
LogicalFont>>height
    ^200
LogicalFont>>width
    ^200

then timeToRun ---> 45msec.

With...
LogicalFont>>height
    self realFont "height".
    ^200.

then timeToRun ---> 1929msec.

If I revert the changes above and then do...
LogicalFont>>realFont    
    "Smalltalk at: #btcHack put: Bag new"
    ^realFont ifNil: [
        (Smalltalk at: #btcHack) add: #count.
        realFont := self findRealFont]   ^

then timeToRun --> 4076
and (Smalltalk at: #btcHack) occurrencesOf: #count ---> 587 times it runs #findRealFont.

This might not be the proper place to do caching, but if change this to...
LogicalFont>>realFont
    | cache  |       
    cache := Smalltalk at: #btcHack2 ifAbsentPut: Dictionary new.
    ^realFont ifNil: [ cache at: self printString ifAbsentPut: [ self findRealFont ] ]

then timeToRun --> 1482msec.


cheers, Ben


Tudor Girba wrote:
Here is more information about the problem: as said, the issue comes from
widthOfString:. So, I tested the basic infrastructure:

[10 to: 100 do: [ :x |
(LogicalFont familyName: 'Arial' pointSize: x)
widthOfString: 'test' ]] timeToRun

This one gets ==> 5s

So, where are the rest of the 20s being spent in Roassal? Essentially,
given that Roassal will get a new logical font instance every time it tries
to display, it essentially slows down everything in the image when multiple
fonts are displayed.

I think we should find a way to cache the logical fonts in
ROFontOrganizerAthens, or at least to provide the ability to set the font
from outside in ROAbstractLabel (rather than just provide the font size).

Cheers,
Doru





On Sat, Aug 24, 2013 at 9:34 AM, Tudor Girba [hidden email] wrote:

  
Indeed, the issue we have is related to real font caching. It would be
great to get a working solution for this. I guess this will not be
available in Pharo 2.0 (it would make sense to focus on Pharo 3.0), but
maybe we can get some hints as to how to build a little workaround.

I would like to release the Moose 4.8 image with Athens enabled, but I am
not sure it's a good idea with this little issue inside.

Doru


On Fri, Aug 23, 2013 at 10:58 PM, Stéphane Ducasse <
[hidden email]> wrote:

    
Igor is working out on textEditor with fernando and they are making
progress.
I know that igor want to build a cache for fonts and that now he changed
the API of Cairo because the previous one was making approximations that
led to
problems when zooming (and then to identify character under the mouse).
Now I do not know how and if it will have an impact (probably on this
one).
One objectives is also to see how to reuse some of the morphs made on top
of Rubric (but not rubric because it is based on the old and bad paragraph
editor).

Stef

Hi,

Try this:
[view := ROMondrianViewBuilder new.
view shape label fontSize: [:x | x ].
view nodes: (10 to: 100).
view open] timeToRun

On my MacBookPro i7 2.6 GHz this takes 23s.

The actual reason is that LogicalFont>>widthOfString: looks up the real
font when the font is not yet cached. And this ends up looking for files on
the disk.

I do not know an easy way out, but as it is, we cannot use font scaling
essentially. And because of that, visualizations like Annotation
Constellation are not practicable anymore:

http://www.themoosebook.org/book/externals/visualizations/annotation-constellation

 Cheers,
Doru

--
www.tudorgirba.com

"Every thing has its own flow"
 _______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


      
--
www.tudorgirba.com

"Every thing has its own flow"

    

  

_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: using athens fonts is dead slow in roassal

Ben Coman
In reply to this post by Ben Coman
Ben Coman wrote:

> After loading Athens, then
> [|view|
> view := ROMondrianViewBuilder new.
> view shape label fontSize: [:x | x ].
> view nodes: (10 to: 100).
> view open]
>
> timeToRun ---> 4767 msec
>
> By cheating...
> LogicalFont>>height
>     ^200
> LogicalFont>>width
>     ^200
>
> then timeToRun ---> 45msec.
>
> With...
> LogicalFont>>height
>     self realFont "height".
>     ^200.
>
> then timeToRun ---> 1929msec.
>
> If I revert the changes above and then do...
> LogicalFont>>realFont    
>     "Smalltalk at: #btcHack put: Bag new"
>     ^realFont ifNil: [
>         (Smalltalk at: #btcHack) add: #count.
>         realFont := self findRealFont]   ^
>
> then timeToRun --> 4076
> and (Smalltalk at: #btcHack) occurrencesOf: #count ---> 587 times it runs
> #findRealFont.
>
> This might not be the proper place to do caching, but if change this to...
> LogicalFont>>realFont
>     | cache  |      
>     cache := Smalltalk at: #btcHack2 ifAbsentPut: Dictionary new.
>     ^realFont ifNil: [ cache at: self printString ifAbsentPut: [ self
> findRealFont ] ]
>
> then timeToRun --> 1482msec.
>  

Oh! my!
unexpected benefit....
subsequent execution have timeToRun --->  65msec.

> cheers, Ben
>
>
> Tudor Girba wrote:
> > Here is more information about the problem: as said, the issue comes from
> > widthOfString:. So, I tested the basic infrastructure:
> >
> > [10 to: 100 do: [ :x |
> > (LogicalFont familyName: 'Arial' pointSize: x)
> > widthOfString: 'test' ]] timeToRun
> >
> > This one gets ==> 5s
> >
> > So, where are the rest of the 20s being spent in Roassal? Essentially,
> > given that Roassal will get a new logical font instance every time it tries
> > to display, it essentially slows down everything in the image when multiple
> > fonts are displayed.
> >
> > I think we should find a way to cache the logical fonts in
> > ROFontOrganizerAthens, or at least to provide the ability to set the font
> > from outside in ROAbstractLabel (rather than just provide the font size).
> >
> > Cheers,
> > Doru
> >
> >
> >
> >
> >
> > On Sat, Aug 24, 2013 at 9:34 AM, Tudor Girba <[hidden email]> wrote:
> >
> >  
> >> Indeed, the issue we have is related to real font caching. It would be
> >> great to get a working solution for this. I guess this will not be
> >> available in Pharo 2.0 (it would make sense to focus on Pharo 3.0), but
> >> maybe we can get some hints as to how to build a little workaround.
> >>
> >> I would like to release the Moose 4.8 image with Athens enabled, but I am
> >> not sure it's a good idea with this little issue inside.
> >>
> >> Doru
> >>
> >>
> >> On Fri, Aug 23, 2013 at 10:58 PM, Stéphane Ducasse <
> >> [hidden email]> wrote:
> >>
> >>    
> >>> Igor is working out on textEditor with fernando and they are making
> >>> progress.
> >>> I know that igor want to build a cache for fonts and that now he changed
> >>> the API of Cairo because the previous one was making approximations that
> >>> led to
> >>> problems when zooming (and then to identify character under the mouse).
> >>> Now I do not know how and if it will have an impact (probably on this
> >>> one).
> >>> One objectives is also to see how to reuse some of the morphs made on top
> >>> of Rubric (but not rubric because it is based on the old and bad paragraph
> >>> editor).
> >>>
> >>> Stef
> >>>
> >>> Hi,
> >>>
> >>> Try this:
> >>> [view := ROMondrianViewBuilder new.
> >>> view shape label fontSize: [:x | x ].
> >>> view nodes: (10 to: 100).
> >>> view open] timeToRun
> >>>
> >>> On my MacBookPro i7 2.6 GHz this takes 23s.
> >>>
> >>> The actual reason is that LogicalFont>>widthOfString: looks up the real
> >>> font when the font is not yet cached. And this ends up looking for files on
> >>> the disk.
> >>>
> >>> I do not know an easy way out, but as it is, we cannot use font scaling
> >>> essentially. And because of that, visualizations like Annotation
> >>> Constellation are not practicable anymore:
> >>>
> >>> http://www.themoosebook.org/book/externals/visualizations/annotation-constellation
> >>>
> >>>  Cheers,
> >>> Doru
> >>>
> >>> --
> >>> www.tudorgirba.com
> >>>
> >>> "Every thing has its own flow"
> >>>  _______________________________________________
> >>> Moose-dev mailing list
> >>> [hidden email]
> >>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> Moose-dev mailing list
> >>> [hidden email]
> >>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
> >>>
> >>>
> >>>      
> >> --
> >> www.tudorgirba.com
> >>
> >> "Every thing has its own flow"
> >>
> >>    
> >
> >
> >
> >  
> > --------------------------------------------------------------------------------
> >
> > _______________________________________________
> > Moose-dev mailing list
> > [hidden email]
> > https://www.iam.unibe.ch/mailman/listinfo/moose-dev
> >  
>
>  



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: using athens fonts is dead slow in roassal

abergel
In reply to this post by Ben Coman
Hi Ben!

Thanks for your experiment. So, what is your conclusion? Can you provide a fix ?

Alexandre


On Aug 24, 2013, at 2:40 PM, Ben Coman <[hidden email]> wrote:

> After loading Athens, then
> [|view|
> view := ROMondrianViewBuilder new.
> view shape label fontSize: [:x | x ].
> view nodes: (10 to: 100).
> view open]
>
> timeToRun ---> 4767 msec
>
> By cheating...
> LogicalFont>>height
>     ^200
> LogicalFont>>width
>     ^200
>
> then timeToRun ---> 45msec.
>
> With...
> LogicalFont>>height
>     self realFont "height".
>     ^200.
>
> then timeToRun ---> 1929msec.
>
> If I revert the changes above and then do...
> LogicalFont>>realFont    
>     "Smalltalk at: #btcHack put: Bag new"
>     ^realFont ifNil: [
>         (Smalltalk at: #btcHack) add: #count.
>         realFont := self findRealFont]   ^
>
> then timeToRun --> 4076
> and (Smalltalk at: #btcHack) occurrencesOf: #count ---> 587 times it runs #findRealFont.
>
> This might not be the proper place to do caching, but if change this to...
> LogicalFont>>realFont
>     | cache  |        
>     cache := Smalltalk at: #btcHack2 ifAbsentPut: Dictionary new.
>     ^realFont ifNil: [ cache at: self printString ifAbsentPut: [ self findRealFont ] ]
>
> then timeToRun --> 1482msec.
>
> cheers, Ben
>
>
> Tudor Girba wrote:
>> Here is more information about the problem: as said, the issue comes from
>> widthOfString:. So, I tested the basic infrastructure:
>>
>> [10 to: 100 do: [ :x |
>> (LogicalFont familyName: 'Arial' pointSize: x)
>> widthOfString: 'test' ]] timeToRun
>>
>> This one gets ==> 5s
>>
>> So, where are the rest of the 20s being spent in Roassal? Essentially,
>> given that Roassal will get a new logical font instance every time it tries
>> to display, it essentially slows down everything in the image when multiple
>> fonts are displayed.
>>
>> I think we should find a way to cache the logical fonts in
>> ROFontOrganizerAthens, or at least to provide the ability to set the font
>> from outside in ROAbstractLabel (rather than just provide the font size).
>>
>> Cheers,
>> Doru
>>
>>
>>
>>
>>
>> On Sat, Aug 24, 2013 at 9:34 AM, Tudor Girba
>> <[hidden email]>
>>  wrote:
>>
>>  
>>
>>> Indeed, the issue we have is related to real font caching. It would be
>>> great to get a working solution for this. I guess this will not be
>>> available in Pharo 2.0 (it would make sense to focus on Pharo 3.0), but
>>> maybe we can get some hints as to how to build a little workaround.
>>>
>>> I would like to release the Moose 4.8 image with Athens enabled, but I am
>>> not sure it's a good idea with this little issue inside.
>>>
>>> Doru
>>>
>>>
>>> On Fri, Aug 23, 2013 at 10:58 PM, Stéphane Ducasse <
>>>
>>> [hidden email]
>>> > wrote:
>>>
>>>    
>>>
>>>> Igor is working out on textEditor with fernando and they are making
>>>> progress.
>>>> I know that igor want to build a cache for fonts and that now he changed
>>>> the API of Cairo because the previous one was making approximations that
>>>> led to
>>>> problems when zooming (and then to identify character under the mouse).
>>>> Now I do not know how and if it will have an impact (probably on this
>>>> one).
>>>> One objectives is also to see how to reuse some of the morphs made on top
>>>> of Rubric (but not rubric because it is based on the old and bad paragraph
>>>> editor).
>>>>
>>>> Stef
>>>>
>>>> Hi,
>>>>
>>>> Try this:
>>>> [view := ROMondrianViewBuilder new.
>>>> view shape label fontSize: [:x | x ].
>>>> view nodes: (10 to: 100).
>>>> view open] timeToRun
>>>>
>>>> On my MacBookPro i7 2.6 GHz this takes 23s.
>>>>
>>>> The actual reason is that LogicalFont>>widthOfString: looks up the real
>>>> font when the font is not yet cached. And this ends up looking for files on
>>>> the disk.
>>>>
>>>> I do not know an easy way out, but as it is, we cannot use font scaling
>>>> essentially. And because of that, visualizations like Annotation
>>>> Constellation are not practicable anymore:
>>>>
>>>>
>>>> http://www.themoosebook.org/book/externals/visualizations/annotation-constellation
>>>>
>>>>
>>>>  Cheers,
>>>> Doru
>>>>
>>>> --
>>>>
>>>> www.tudorgirba.com
>>>>
>>>>
>>>> "Every thing has its own flow"
>>>>  _______________________________________________
>>>> Moose-dev mailing list
>>>>
>>>> [hidden email]
>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>>
>>>> [hidden email]
>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>
>>>>
>>>>
>>>>      
>>>>
>>> --
>>>
>>> www.tudorgirba.com
>>>
>>>
>>> "Every thing has its own flow"
>>>
>>>    
>>>
>>
>>
>>
>>  
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>>
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>>  
>>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: using athens fonts is dead slow in roassal

Tudor Girba-2
I already committed a fix. Look at the details in:


On Mon, Aug 26, 2013 at 12:06 AM, Alexandre Bergel <[hidden email]> wrote:
Hi Ben!

Thanks for your experiment. So, what is your conclusion? Can you provide a fix ?

Alexandre


On Aug 24, 2013, at 2:40 PM, Ben Coman <[hidden email]> wrote:

> After loading Athens, then
> [|view|
> view := ROMondrianViewBuilder new.
> view shape label fontSize: [:x | x ].
> view nodes: (10 to: 100).
> view open]
>
> timeToRun ---> 4767 msec
>
> By cheating...
> LogicalFont>>height
>     ^200
> LogicalFont>>width
>     ^200
>
> then timeToRun ---> 45msec.
>
> With...
> LogicalFont>>height
>     self realFont "height".
>     ^200.
>
> then timeToRun ---> 1929msec.
>
> If I revert the changes above and then do...
> LogicalFont>>realFont
>     "Smalltalk at: #btcHack put: Bag new"
>     ^realFont ifNil: [
>         (Smalltalk at: #btcHack) add: #count.
>         realFont := self findRealFont]   ^
>
> then timeToRun --> 4076
> and (Smalltalk at: #btcHack) occurrencesOf: #count ---> 587 times it runs #findRealFont.
>
> This might not be the proper place to do caching, but if change this to...
> LogicalFont>>realFont
>     | cache  |
>     cache := Smalltalk at: #btcHack2 ifAbsentPut: Dictionary new.
>     ^realFont ifNil: [ cache at: self printString ifAbsentPut: [ self findRealFont ] ]
>
> then timeToRun --> 1482msec.
>
> cheers, Ben
>
>
> Tudor Girba wrote:
>> Here is more information about the problem: as said, the issue comes from
>> widthOfString:. So, I tested the basic infrastructure:
>>
>> [10 to: 100 do: [ :x |
>> (LogicalFont familyName: 'Arial' pointSize: x)
>> widthOfString: 'test' ]] timeToRun
>>
>> This one gets ==> 5s
>>
>> So, where are the rest of the 20s being spent in Roassal? Essentially,
>> given that Roassal will get a new logical font instance every time it tries
>> to display, it essentially slows down everything in the image when multiple
>> fonts are displayed.
>>
>> I think we should find a way to cache the logical fonts in
>> ROFontOrganizerAthens, or at least to provide the ability to set the font
>> from outside in ROAbstractLabel (rather than just provide the font size).
>>
>> Cheers,
>> Doru
>>
>>
>>
>>
>>
>> On Sat, Aug 24, 2013 at 9:34 AM, Tudor Girba
>> <[hidden email]>
>>  wrote:
>>
>>
>>
>>> Indeed, the issue we have is related to real font caching. It would be
>>> great to get a working solution for this. I guess this will not be
>>> available in Pharo 2.0 (it would make sense to focus on Pharo 3.0), but
>>> maybe we can get some hints as to how to build a little workaround.
>>>
>>> I would like to release the Moose 4.8 image with Athens enabled, but I am
>>> not sure it's a good idea with this little issue inside.
>>>
>>> Doru
>>>
>>>
>>> On Fri, Aug 23, 2013 at 10:58 PM, Stéphane Ducasse <
>>>
>>> [hidden email]
>>> > wrote:
>>>
>>>
>>>
>>>> Igor is working out on textEditor with fernando and they are making
>>>> progress.
>>>> I know that igor want to build a cache for fonts and that now he changed
>>>> the API of Cairo because the previous one was making approximations that
>>>> led to
>>>> problems when zooming (and then to identify character under the mouse).
>>>> Now I do not know how and if it will have an impact (probably on this
>>>> one).
>>>> One objectives is also to see how to reuse some of the morphs made on top
>>>> of Rubric (but not rubric because it is based on the old and bad paragraph
>>>> editor).
>>>>
>>>> Stef
>>>>
>>>> Hi,
>>>>
>>>> Try this:
>>>> [view := ROMondrianViewBuilder new.
>>>> view shape label fontSize: [:x | x ].
>>>> view nodes: (10 to: 100).
>>>> view open] timeToRun
>>>>
>>>> On my MacBookPro i7 2.6 GHz this takes 23s.
>>>>
>>>> The actual reason is that LogicalFont>>widthOfString: looks up the real
>>>> font when the font is not yet cached. And this ends up looking for files on
>>>> the disk.
>>>>
>>>> I do not know an easy way out, but as it is, we cannot use font scaling
>>>> essentially. And because of that, visualizations like Annotation
>>>> Constellation are not practicable anymore:
>>>>
>>>>
>>>> http://www.themoosebook.org/book/externals/visualizations/annotation-constellation
>>>>
>>>>
>>>>  Cheers,
>>>> Doru
>>>>
>>>> --
>>>>
>>>> www.tudorgirba.com
>>>>
>>>>
>>>> "Every thing has its own flow"
>>>>  _______________________________________________
>>>> Moose-dev mailing list
>>>>
>>>> [hidden email]
>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>>
>>>> [hidden email]
>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>
>>>>
>>>>
>>>>
>>>>
>>> --
>>>
>>> www.tudorgirba.com
>>>
>>>
>>> "Every thing has its own flow"
>>>
>>>
>>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>>
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>>
>>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev