Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336751 - HTMLResourceEncodingGuesser reading stream unnecessarily
Summary: HTMLResourceEncodingGuesser reading stream unnecessarily
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.html (show other bugs)
Version: 3.2.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.4   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard: WI60406
Keywords: performance
Depends on:
Blocks:
 
Reported: 2011-02-09 14:54 EST by Nick Sandonato CLA
Modified: 2011-03-02 10:24 EST (History)
1 user (show)

See Also:
thatnitind: review+


Attachments
patch (3.73 KB, patch)
2011-02-09 14:58 EST, Nick Sandonato CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.