This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 187398 - Minimize IO needed by FileEncodingQuery
Summary: Minimize IO needed by FileEncodingQuery
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 7.0
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-09 18:08 UTC by Tomas Zezula
Modified: 2010-06-12 06:51 UTC (History)
2 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
Diff file (19.20 KB, patch)
2010-06-09 18:08 UTC, Tomas Zezula
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Zezula 2010-06-09 18:08:44 UTC
Created attachment 99948 [details]
Diff file

Originally the HtmlFileEncodingQuery required IO every time it was used. So reading the Html file required that the 4K header of the file was red twice. For indexing 4 times as the file is read by Source used by HtmlIndexer and also TaskListIndexer. The introduced cache helped by decreasing the time in FEQ by ~ 10%. The cache caches the encoding, so it's calculated once => 3 IO ops. But the DataObject may be gced and and recreated which happens during mem intensive initial scan. So for gced DOs the 4 ops are done.
I've rewritten the htmlFEQ to work in the same way as XMLFeq. It returns a dummy charset which selects the right one when it's used and delegates to it. So there is no IO for finding the encoding. The indexing now needs only 2 IO ops per html file.

The tests are passing fine. The only change is that the returned Charset is a proxy and cannot be asked about name and so on. But it should not be a problem as most of the files including XML are doing so and no client should rely on it.

I am attaching a diff file. Marku, can you review it? If you agree I will commit it.
Thanks
Comment 1 Marek Fukala 2010-06-10 10:10:06 UTC
Nice solution Tome, looks ok to me and seems to be compatible with the "on document save/load encoding handling magic" in HtmlEditorSupport . Thanks!
Comment 2 Tomas Zezula 2010-06-10 15:00:29 UTC
Thanks Marku for review.
I am going to integrate it.
Comment 3 Tomas Zezula 2010-06-10 15:27:55 UTC
Fixed in jet-main 6fb1f9813f57
Comment 4 Quality Engineering 2010-06-12 06:51:39 UTC
Integrated into 'main-golden', will be available in build *201006120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/6fb1f9813f57
User: Tomas Zezula <tzezula@netbeans.org>
Log: #187398:Minimize IO needed by FileEncodingQuery