Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

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

Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology
Status: New
Owner: ----
CC: [hidden email]
Labels: Type-Defect Priority-Medium Component-Roassal Milestone-4.8

New issue 971 by [hidden email]: Using Athens fonts is dead slow in  
Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

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.

What is even worse is that the widthOfString: is being called during the  
rendering cycle, so the whole image gets slow.

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology
Updates:
        Status: Fixed

Comment #1 on issue 971 by [hidden email]: Using Athens fonts is dead  
slow in Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

Name: Roassal-TudorGirba.648
Author: TudorGirba
Time: 24 August 2013, 10:48:31.666 pm
UUID: b797927f-c4f9-40c5-b14d-30ecfccab900
Ancestors: Roassal-TudorGirba.647

Issue 971: Using Athens fonts is dead slow in Roassal
       
fixed by caching the font in ROAbstractLabel

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology

Comment #2 on issue 971 by [hidden email]: Using Athens fonts is dead  
slow in Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

After the fix, the same code works in 5s. To be mentioned that

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

takes a bit less than 5s on my machine. Thus, essentially, the time spent  
now on the rendering is only due to the first lookup of the fonts (no extra  
lookup is performed). This is reasonable and it will get better once we get  
a better caching at the Pharo level.

The cached font is reset on modelChanged:

I think this is a good enough solution.

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology
Updates:
        Status: New

Comment #3 on issue 971 by [hidden email]: Using Athens fonts is dead  
slow in Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

Ok, I was too fast.

This does not work properly because when we zoom in or out, we want to  
refresh the font to make it larger or smaller. To this end, we should  
probably add the cache in the ROFontOrganizerAthens.

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology

Comment #4 on issue 971 by [hidden email]: Using Athens fonts is  
dead slow in Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

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.

subsequent runs have timeToRun --->  65msec.


--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology

Comment #5 on issue 971 by [hidden email]: Using Athens fonts is  
dead slow in Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

> when we zoom in or out, we want to refresh the font to make it larger or  
> smaller.

If you zoom through 100 unloaded point sizes, then it will likely be as  
slow.  I can only think something convoluted like bitmap scaling the font  
during the zoom would work.

Would you not keep the same font and Athens handle zooming?

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology

Comment #6 on issue 971 by [hidden email]: Using Athens fonts is  
dead slow in Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

btw, it seems that ROFontOrganizerAthens is not used, see attached.

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology

Comment #7 on issue 971 by [hidden email]: Using Athens fonts is  
dead slow in Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

btw, it seems that ROFontOrganizerAthens is not used, see attached.

Attachments:
        ROFontOrganizerAthens-not-used.png  77.3 KB

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology

Comment #8 on issue 971 by [hidden email]: Using Athens fonts is dead  
slow in Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

That is because you did not install Athens :). It's not enough to load  
Athens in the image. You also need to tell Roassal to use Athens.

MooseImageSetupCommandLineHandler>>#installAthens
        Gofer new
                smalltalkhubUser: 'Pharo' project: 'Athens';
                package: 'ConfigurationOfAthens';
                load.
        (Smalltalk at: #ConfigurationOfAthens) loadVersion: '2.1'.
        Gofer new
                smalltalkhubUser: 'ObjectProfile' project: 'Roassal';
                package: 'RoassalAthens';
                load.
        ROPlatform setCurrent: 'athens'.

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology
Updates:
        Status: Fixed

Comment #9 on issue 971 by [hidden email]: Using Athens fonts is dead  
slow in Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

Ok, I moved the cache to ROFontsOrganizerAthens and it seems to work  
reasonably fine.

Name: RoassalAthens-TudorGirba.8
Author: TudorGirba
Time: 25 August 2013, 10:01:01.158 am
UUID: c0708bdf-583f-47fa-b622-aeaf329939a4
Ancestors: RoassalAthens-AlexandreBergel.7

added a defaultFonts cache to ROFontsOrganizerAthens to lazily cache the  
default fonts per size. While the first time a certain size is used can  
still be slow, subsequent calls are fast. This makes rendering  
significantly faster.

However, zooming in the presence of large amounts of fonts can still be  
slow.

Also, we now use the "StandardFonts defaultFont fontFamily" as the default  
font family instead of the hardcoded Arial.

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology

Comment #10 on issue 971 by [hidden email]: Using Athens fonts is  
dead slow in Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

> That is because you did not install Athens :). It's not enough to load  
> Athens in the image. You also need to tell Roassal to use Athens.

No, :) I did listen the first time, but...

ROPlatform current   ---> a ROPharoAthensPlatform
ROFontOrganizer current  ---> ROFontOrganizerMorphic

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology

Comment #11 on issue 971 by [hidden email]: Using Athens fonts is  
dead slow in Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

Ah, as far as I see, this mechanism is not used.

This is what gets used in ROAbstractLabel:

ROPlatform current fontOrganizerClass.

Actually, there are too many singletons in Roassal :)

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology

Comment #12 on issue 971 by [hidden email]: Using Athens fonts is  
dead slow in Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

Hi Doru,

What is the status on that issue?
It is marked as fixed but I am not sure to have understood the fix for this

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 971 in moose-technology: Using Athens fonts is dead slow in Roassal

moose-technology

Comment #13 on issue 971 by [hidden email]: Using Athens fonts is  
dead slow in Roassal
http://code.google.com/p/moose-technology/issues/detail?id=971

Ah sorry, I missed  RoassalAthens-TudorGirba.8
Ok now :-)

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev