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

Bug 336751

Summary: HTMLResourceEncodingGuesser reading stream unnecessarily
Product: [WebTools] WTP Source Editing Reporter: Nick Sandonato <nsand.dev>
Component: wst.htmlAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nick Sandonato <nsand.dev>
Severity: normal    
Priority: P3 CC: thatnitind
Version: 3.2.3Keywords: performance
Target Milestone: 3.2.4Flags: thatnitind: review+
Hardware: PC   
OS: Windows XP   
Whiteboard: WI60406
Attachments:
Description Flags
patch none

Description Nick Sandonato CLA 2011-02-09 14:54:56 EST
After work was done on Bug 333925, I came to realize another inefficiency. Right now, the HTMLResourceEncodingDetector will try to read in bytes for the EncodingGuesser to work on; however, the EncodingGuesser only ever will work for Japanese encodings.

So it seems like we're doing a lot of extra work.
Comment 1 Nick Sandonato CLA 2011-02-09 14:58:08 EST
Created attachment 188617 [details]
patch

Patch makes it so that only if the EncodingGuesser is capable of making a guess will it bother reading from the stream. In a large enough workspace (~1020 HTML files) I saw IFile#getContentDescription() times go from ~10ms per file down to about .66ms per file.
Comment 2 Nick Sandonato CLA 2011-03-02 10:24:32 EST
Code checked in. Thanks, Nitin.