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.
Summary: | CachedInputStream is slow | ||
---|---|---|---|
Product: | platform | Reporter: | Petr Nejedly <pnejedly> |
Component: | Filesystems | Assignee: | rmatous <rmatous> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | issues, pjiricka |
Priority: | P3 | Keywords: | PERFORMANCE |
Version: | 5.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 114195 | ||
Attachments: | pathc for read impl. |
Description
Petr Nejedly
2007-10-02 11:58:51 UTC
... an I don't want to know what will happen with xml sniffing mime resolvers, which tend to process much larger chunks of data. This bug should be quite simple to fix. Need more profiling. It might be the case that although the single byte read() gets called many times, the time is actually spent in the underlaying JDK+native read method (clod caches). Anyway, it won't hurt to have read(byte[], int, int) implemented, it's just 10 or so lines of code. Created attachment 50066 [details]
pathc for read impl.
The patch is OK though a bit confusing: int buflen = Math.max(len, blen); buflen = (buflen > 0) ? (buflen * 2) : 256; It works only because pos is never more than len. I would expect the first line would read "int buflen = pos+blen" (which is always more than len) and the second line can never take the ":256" branch anyway. Well, it can, if len=0 and blen=0, but such case (just for correctness, I don't expect anybody calling it this way) should be covered by the initial if, which should, in fact read boolean isCached = (pos + blen <= len); // less or EQUALS I'd refactor the buffer refill into a separate routine used from both read methods, though. /cvs/openide/fs/src/org/openide/filesystems/MIMESupport.java,v <-- MIMESupport.java new revision: 1.23; previous revision: 1.22 Patch slightly modified and fixed. Rollback - reopened /cvs/openide/fs/src/org/openide/filesystems/MIMESupport.java,v <-- MIMESupport.java new revision: 1.25; previous revision: 1.24 |