Bug 61975 - [content type] avoid reading contents when not needed
Summary: [content type] avoid reading contents when not needed
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M3   Edit
Assignee: Rafael Chaves CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2004-05-12 14:57 EDT by Rafael Chaves CLA
Modified: 2004-10-07 11:58 EDT (History)
1 user (show)

See Also:


Attachments
patch against org.eclipse.core.resources (4.45 KB, patch)
2004-10-06 17:36 EDT, Rafael Chaves CLA
no flags Details | Diff

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