in fact cannot the cache be class side? beucase now each time you do HelpBrowser open, you compute again the cache....but I am not sure if they should change amont different opened browsers
Could be. It is important to have a scenario. The problem is getting the pragmas from the whole system. If you put the cache on the class side, then you will indeed need to reset the cache, by registering to the system events. The reset has to be performed at each installation of a new help. This is a bit more work. Shall we do to that direction? I think it makes sense. Alexandre
On Sat, Apr 30, 2011 at 5:07 PM, Alexandre Bergel <alexandre.bergel@me.com> wrote: Yes, but this depends what is the expected behavior of the browser. I like the Agile approach that says you're done when all the tests are green :-)
Alexandre
On 30 Apr 2011, at 10:02, Mariano Martinez Peck wrote:
Yes, but I have no idea. Another thing is that now HelpBrowser should implement something like:
HelpBrowser >> cleanUp self resetChache
resetCache helpTopicCache := nil
So that the class is automatically cleaned in #cleanUpForRelease and friends... right now since Smalltalk cleanUp sends to all classes which understand such method, just implemented that should be enough.
Cheers
Mariano
On Sat, Apr 30, 2011 at 4:58 PM, Alexandre Bergel <alexandre.bergel@me.com> wrote: You're right Mariano. However, I do not know if the help browser gets updated if you have a browser opened and add a new help in the system. In any case, this is a requirement that is not formalized by the unit tests.
I think that ideally, the reset cache should be done when receiving an event of a class creation that is a help.
Alexandre
On 30 Apr 2011, at 09:29, Mariano Martinez Peck wrote:
Cool! Thanks Alexandre. Now...the problem with the cache is always the same...when to invalidate them. In this case, when do I need to set helpTopicCache to nil. I guess that if you create a help, then it is "automatically" detected when you open the browser. Now, you have to explicitly flush the cache, haven't you? So...is there some documentation of HelpSystem that should be updated to reflect that ?
Thanks
On Sat, Apr 30, 2011 at 3:15 AM, Alexandre Bergel <alexandre.bergel@me.com> wrote:
MessageTally time: [HelpBrowser open] between 2 seconds in Cog and with a regular VM between 6 and 8.... is there an easy way to improve it ?
Alexandre, do you want another place where to put a cache like Metacello's currentVersion? ;)
:-) Sure. Easy.
SystemHelp>>allSystemHelpPragmas takes time. When you open a browser, the method HelpBrowser>>open is called once and SystemHelp>>allSystemHelpPragmas twice. Easy to suspect that a cache is missing.
So, if you define -=-=-=-=-=-=-=-=-= HelpBrowser>>helpTopic ^ helpTopicCache ifNil: [ helpTopicCache := rootTopic asHelpTopic ] -=-=-=-=-=-=-=-=-=
and adapt HelpBrowser>>refresh you win 50% of execution time.
Here is it:
http://code.google.com/p/pharo/issues/detail?id=4126
Before this fix, I have: [HelpBrowser open] timeToRun => 6099
After the fix I have: [HelpBrowser open] timeToRun => 3094
Naturally, tests are kept green.
Cheers, Alexandre
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- Mariano http://marianopeck.wordpress.com
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- Mariano http://marianopeck.wordpress.com
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- Mariano http://marianopeck.wordpress.com
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.