Bug 61975

Summary: [content type] avoid reading contents when not needed
Product: [Eclipse Project] Platform Reporter: Rafael Chaves <eclipse>
Component: RuntimeAssignee: Rafael Chaves <eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jeffmcaffer
Version: 3.0Keywords: performance
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch against org.eclipse.core.resources none

Description Rafael Chaves CLA 2004-05-12 14:57:41 EDT
We are reading input streams provided by clients for content description too
eagerly. We should read only when a describer actually requests bytes to be
interpreted. For content types that do not have a content describer, file reads
could be avoided. It would be even better if the input streams handed by clients
did not do any work before read was called (FileInputStreams open the file in
the constructor, for instance). We could do that at least for the client we
control: IFile#getContentDescription, which BTW is currently the heaviest one.
Comment 1 Rafael Chaves CLA 2004-05-20 12:37:22 EDT
Adding Jeff, the performance police.
Comment 2 Rafael Chaves CLA 2004-05-27 12:40:07 EDT
Actually, in practice this would be a rather rare scenario (empty files, or no
corresponding content type, or content types without describers).

Deferring.
Comment 3 Rafael Chaves CLA 2004-07-13 15:03:18 EDT
Reopening.
Comment 4 Rafael Chaves CLA 2004-10-06 17:36:07 EDT
Created attachment 15027 [details]
patch against org.eclipse.core.resources

The patch changes the way IFile#getContentDescription to that it postpones the
file opening until bytes are actually requested. This happens in cases such as
content types with no content describers (file name association only) or files
with names for which there are no content types associated.
Comment 5 Rafael Chaves CLA 2004-10-07 11:58:40 EDT
Fix reviewed by DJ. Released to HEAD.