Bug 26961 - Performance: launching help should be fast
Summary: Performance: launching help should be fast
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Platform-Help-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2002-11-22 10:47 EST by Dorian Birsan CLA
Modified: 2003-01-15 16:19 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dorian Birsan CLA 2002-11-22 10:47:29 EST
Investigate performance improvements for starting up the help viewer.

We are launching the browser in another VM (Windows) or launch the system 
browser, but there could be some optimizations there.

Rendering of the help UI should be reasonable fast (precompiled JSP, optimized 
HTML, etc.)
Comment 1 Dorian Birsan CLA 2002-11-22 10:48:31 EST
Investigate browsing of large documents (1-10 meg)
Comment 2 Konrad Kolosowski CLA 2002-11-25 17:04:24 EST
Browsing large documents ~10MB is robust.  Document is displayed almost 
immidiately, and continues loading in the background (shell responds).  Same 
behaviour is when using external browser.  Loading document through help server 
is not noticably slower than openning the file in a browser straight from a 
file system.

The problem appears when a large document ~1MB is a result of search.  
Javascript hightlighting code appears to freeze the shell for a duration of its 
run.  It takes in the order of 10s/MB to highlight 1 keyword.
For example, displaying 1MB document, result of search for "end of file" takes 
15s.  Displaying 10MB document, result of search for (unquoted) 'end of file' 
takes forever (did not finish in 5 minutes).  Eclipse responds, but closing it, 
does not close the browser, until highlighting code ends.  The browser process 
needs to be killled to reopen help.  Same behavior when an external Internet 
Explorer is used.
Comment 3 Konrad Kolosowski CLA 2002-11-26 13:40:38 EST
Released the code to limit duration of highlighting code for documents > 50k.  
In these documents the search keyword highlighting code will terminate after 3 
seconds, even if not all terms have yet been higlighted.
The new code that checks time is not added to code used for highlighting of 
shorter documents since the extra code adds decreases highlighting speed by 15%.
Comment 4 Konrad Kolosowski CLA 2002-11-26 15:44:27 EST
Constructing IEBrowserAdapter object, used to launch external viewer with 
Embeded IE browser takes long (almost 4 seconds with profiling turned on).  Its 
getClasspath method takes most of this time).
Comment 5 Konrad Kolosowski CLA 2002-11-26 18:35:33 EST
Released optimized code to decrease execution time of 
IEBrowserAdapter.getClasspath from 3.59 to 0.77 seconds.  Also cache the 
command to launch external process, once the command is constructed.  As a 
result of teose optimizations, constructing IEBrowserAdapter now takes 1.0 
second (down from 3.96) for the first time, and ~0 for the next.
Comment 6 Jeff McAffer CLA 2002-11-27 23:12:40 EST
This looks great.  Well done. Any idea how it would be affected by the use of 
an internal viewer like Mozilla?
Comment 7 Konrad Kolosowski CLA 2002-11-28 11:50:41 EST
Jeff,
I do not know what implementation internal browser like Mozilla would use.  
Likely there would be different completely different issues.  The problem was 
specific to the way we launched window with embeded IE.

Opening window with embedded IE took long for two reasons.  Because, IE browser 
window is run as separate JVM process (and SWT application), it takes some time 
for the other JVM to start and we do not see a way to speed it up.  
Unfortunately due to modality issues help browser is preferred to be out of 
process.
The other reason it was taking long to start was that we need to calculate the 
classpath to pass to the new process.  Since the code uses classes from help 
UI, JFace, SWT, and it is not possible to pass a class loader to another 
process, our code inside Eclipse was obtaining lists of JAR URLs from help ui 
plugin and all plugins in its require chain.  With many requires present in 
those plugins, we got a list that was almost a thousand URLs, since there were 
many duplicates.  We were collecting and processing all of them before ensuring 
there is no duplicates.  After a fix, a HashSet is used from the start to 
eliminate duplicates, and no unnecessary processing is done.
Comment 8 Konrad Kolosowski CLA 2002-11-28 12:03:05 EST
Browsing large documents is not slow, but has large memory requirement.  The 
content filters work on a byte[] that hold complete document in the memory for 
a period of time.  This should be changed so filters work on streams and 
possibly have bounded size buffer in the memory.  This needs to be fixed, 
especially that more than one document can be accessed at a time (on separate 
threads), and the total memory requirement may be greater than size of any 
large document alone.
Comment 9 Konrad Kolosowski CLA 2002-11-28 18:09:14 EST
I have redesigned document content filters to direclty filter OutputStream 
without a need for any buffer.
Comment 10 Dorian Birsan CLA 2003-01-02 22:53:47 EST
I played a bit with the generated html code for a book and tried to make it 
smaller. Here are some numbers:

The generated HTML for the Platform Plug-in Developer's Guide is about 98.9K.
I performed the following (in this order):
- removed the <nobr> tag resulted in a 94.1K file. Note: this tag is only needed
  in the IE5.0 browser to properly render each topic title on the same line.
  Newer browsers can use proper CSS support for this.
- replaced the image names topic.gif, content_obj.gif and plus.gif by t.gif, 
  c.gif and p.gif and the resulting file was 92.2K
- replaced the images/ directory with i/ and the file was reduced to 87.6K
- replaced the hidden style attribute for plus.gif (on topic leaves) by 
  class='h' and move the definition in the <style> tag at the beginning 
  resulted in a file of size 82.6K

I have not checked in any of these changes, but it looks we can get about 20% 
reduction in the size of the navigation file when using more cryptic names.
Comment 11 Dorian Birsan CLA 2003-01-08 16:43:07 EST
I checked in changes for the first and last steps (eliminated <nobr> and the 
style definition for hidden image), and also eliminated the title attribute, 
and set it with javascript.
Comment 12 Dorian Birsan CLA 2003-01-14 15:20:49 EST
Fixed