Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360428

Summary: HTML Generator is slow
Product: z_Archived Reporter: Tony Chen <chenzhh>
Component: EDTAssignee: Huang Ji Yong <hjiyong>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: mayunf, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
html gen performance improvement
lasher: iplog+
The updated fix lasher: iplog+

Description Tony Chen CLA 2011-10-10 08:09:01 EDT
HTML Generator normally takes 3 seconds to gen a simple handler on my machine. I profiled with YourKit and found that IRUtils.getReferencedPartsFor() is taking most of the execution time. And HTMLGen is calling that function several times (in generateIncludeFiles, generateDependentFilePath, generatePropertiesFiles & generateCSSFiles). I did not see any easy way to improve getReferencedPartsFor() itself, so I tried to cache result and reuse it in one HTML Gen transaction. It has reduced HTML gen time from 3 seconds to less then a seconds for me. 

I'm attaching my patch here. Jiyong, please verify it and if you feel ok, please deliver it. 

Problems to be resolved:
  In RUITemplate.generateDependentFilePath(). the order is not guarantee. I put a TODO there. We may need to figure out this before delivering the fix. 
  The code in TypeTemplate is not called anymore. I did not know what this piece of code is used for. Something might be broken.
Comment 1 Tony Chen CLA 2011-10-10 08:10:16 EDT
Created attachment 204874 [details]
html gen performance improvement
Comment 2 Huang Ji Yong CLA 2011-10-10 22:08:30 EDT
The order is critical, we must fix that before commit the change.
I think we can remove TypeTemplate now.
Another 2 changes I think we can make to this patch
1. If we remove Service/Interface template, we have to filter these types out before invoking genOutPutFileName.
2. Leave libraryTemplate, because genPropFiles makes no sense for a handler, it should be in a library.

Add Yun Feng to cclist, he may have more comments.

(In reply to comment #0)
> HTML Generator normally takes 3 seconds to gen a simple handler on my machine.
> I profiled with YourKit and found that IRUtils.getReferencedPartsFor() is
> taking most of the execution time. And HTMLGen is calling that function several
> times (in generateIncludeFiles, generateDependentFilePath,
> generatePropertiesFiles & generateCSSFiles). I did not see any easy way to
> improve getReferencedPartsFor() itself, so I tried to cache result and reuse it
> in one HTML Gen transaction. It has reduced HTML gen time from 3 seconds to
> less then a seconds for me. 
> 
> I'm attaching my patch here. Jiyong, please verify it and if you feel ok,
> please deliver it. 
> 
> Problems to be resolved:
>   In RUITemplate.generateDependentFilePath(). the order is not guarantee. I put
> a TODO there. We may need to figure out this before delivering the fix. 
>   The code in TypeTemplate is not called anymore. I did not know what this
> piece of code is used for. Something might be broken.
Comment 3 Huang Ji Yong CLA 2011-10-11 10:11:43 EDT
Created attachment 204952 [details]
The updated fix
Comment 4 Huang Ji Yong CLA 2011-10-11 10:15:55 EDT
Merge the fix of first patch of Tony, an updated patch form Tony to fix the dependent order and other small changes in comment 2.
Test it for all the widgets, do not find any regression defect of HTML gen.
Comment 5 Tony Chen CLA 2011-10-12 02:50:03 EDT
refactored PartReferenceCache according to Brian's suggestion. 

It's now reusing IRUtil.getReferencedPartsFor().
Comment 6 Tony Chen CLA 2011-10-20 07:44:00 EDT
close this.