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.
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
Nice solution Tome, looks ok to me and seems to be compatible with the "on document save/load encoding handling magic" in HtmlEditorSupport . Thanks!
Thanks Marku for review. I am going to integrate it.
Fixed in jet-main 6fb1f9813f57
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