Issue 94929

Summary: Previews/ thumbnails of template page masters get recreated on every app open
Product: Impress Reporter: milek_pl
Component: uiAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: groucho266, issues
Version: OOo 3.0   
Target Milestone: ---   
Hardware: Unknown   
OS: All   
Issue Type: ENHANCEMENT Latest Confirmation in: ---
Developer Difficulty: ---

Description milek_pl 2008-10-14 19:23:23 UTC
The preview pane under Page Masters > Available for Use generates all template
page masters on every application open. With a large number of large templates,
this becomes very slow and almost freezes UI.

However, all templates already contain thumbnails stored as images ready to use
in the internal Thumbnails\ directory. Though there is an issue #43354 that
means that sometimes thumbnails are not what they should be, templates can be
tweaked by their authors to have the proper thumbnail displayed by default. I
think this will speed up Impress a lot.

As the default behavior discourages from using large template extensions and
slows down the application, it should be considered a defect as it is creating
the previews without any further need. And these previews are not stored
anywhere (they could be stored in Thumbnails\ if there were no thumbnails
already!), they get recreated all the time. This is definitely a waste of resources.
Comment 1 wolframgarten 2008-10-15 13:14:29 UTC
Changed to enhancement. Reassigned.
Comment 2 milek_pl 2008-10-15 17:16:16 UTC
This behavior can be solved by replacing the code that creates the thumbnails
with the code that creates the current previews as in the issue #43354.
Comment 3 groucho266 2008-10-16 09:22:20 UTC
@milek_pl: This is a misunderstanding.  Issue 43354 describes an unrelated
problem.  By the way,  the thumbnails in all three master page controls in the
task pane are all created by the same code.  So what you request, if I
understand you correctly, does not solve but cause the problem.
Comment 4 milek_pl 2008-10-16 09:37:34 UTC
milek_pl->af: You probably didn't read my msg on dev@. OK, this is what I propose:

1) Fix issue #43354 by using the thumbnailing code that already exists for
master pages.

2) Reuse the thumbnails generated by the fixed code in the template files for
thumbnailing in the available master pages pane. Note that the slow-down is
visible only when you have a lot of available templates (the used master pages
or recently used master pages lists are never that long), so fixing it here
should be enough.

The reason why I'm proposing this solution is that you mentioned that the
thumbnails in the templates do not show master pages right now, so they are not
reusable as master pages but this is exactly issue #43354.

I hope it's clear now. I addressed more details on the dev@ mailing list yesterday.
Comment 5 milek_pl 2008-10-16 09:43:02 UTC
Adding af to CC.
Comment 6 groucho266 2008-10-16 10:33:37 UTC
@milek_pl: You are right, I did not read your message on  I
am sorry.  But I did that in the meantime and it does not change what I have said: 

1) Issue 43354 is unrelated,  fixing it will not help with this problem in any
way (except that the lists of used master pages become longer). 

2) All three master page controls in the task pane ("Used in this Presentation",
"Recently Used", "Available for Use") already use the code for rendering master
page that you propose (but maybe I still don't understand what you mean).

I will shortly describe how the previews of the "Available for Use" list are
generated so that we all talk about the same thing.

Two directories inside the Office installation are searched for template documents.
All documents found in these directories are then loaded and their first master
page is rendered into a preview.  The template document is discarded and the
preview is put into a cache that is used by all three master page controls. 
Eventually the preview is displayed.

The part that takes the longest time is of course the loading of the template
Using the preview that is stored in the template documents would take less time.
Using a persistent cache would (probably) take even less time.
Comment 7 milek_pl 2008-10-16 13:03:25 UTC
milek->af: OK, thanks for the explanation. I thought that issue 43354 is related
because it would make possible to reuse the previews stored as thumbnails in
template files, and that would mean at least some caching, so this should work
faster. I don't know how fast but judging with the command line tools, I'd say a
lot faster - it took 3 minutes in OOo and something like 15 secs in the command
line to unpack the previews with 7zip, rename them, and put into a directory
(for the same set of 40 templates).

The previews in "Used in this Presentation" and  "Recently Used" lists are not
such a big problem as these lists are always shorter. Nobody would dream of
having 100 master pages in a presentation whereas one could easily have hundreds
of templates.

Of course, it's possible to solve this problem by creating some universal cache,
like a set of image files and parameters (names) stored in an xml or even text
file (or binary one for speed). But that would mean unnecessary discarding the
existing previews from templates, IMHO, as the thumbnails have been already
created so why should we create them again? Anyway, XML + images could be a way
that could be also implemented in an extension: the extension author could
create a preview and store it in the file, so that OOo would simply read the
cache and display it. But this kind of universal solution is much harder than
simply reading the existing thumbnails from the template files.