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 47926 - ImageDataLoader is slow
Summary: ImageDataLoader is slow
Status: CLOSED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Image (show other bugs)
Version: 4.x
Hardware: PC All
: P2 blocker (vote)
Assignee: issues@utilities
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2004-08-25 15:52 UTC by _ rkubacki
Modified: 2006-03-24 10:02 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ rkubacki 2004-08-25 15:52:50 UTC
ImageDataLoader.findPrimaryFile method is
inefficient. It asks JavaIO API for ImageReader
when a file without extension that is known to be
image is encountered.

I am not sure if we can write good MIME resolver
but at least it should be possible to cache
extensions that do not have image readers so that
imageio is not queried repeatedly.
Comment 1 Jan Jancura 2004-08-26 16:29:12 UTC
fixed in the main trunk:

caching of extensions added, thanks for hint.

QA try to open some images with different extensions (.jpg, .gif...)


Index: src/org/netbeans/modules/image/ImageDataLoader.java
===================================================================
RCS file: /cvs/image/src/org/netbeans/modules/image/ImageDataLoader.java,v
retrieving revision 1.25
diff -r1.25 ImageDataLoader.java
17a18,19
> import java.util.HashSet;
> import java.util.Set;
39a42,43
>     private static Set notSupportedExtensions = new HashSet ();
>     
70,74c74,82
<             Iterator it =
javax.imageio.ImageIO.getImageReadersBySuffix(ext);
<             if( it.hasNext() ){
<                 /* Use the first available ImageIO loader */
<                 retValue = fo;
<                 getExtensions().addExtension(ext);
---
>             
>             if (!notSupportedExtensions.contains (ext)) {
>                 Iterator it =
javax.imageio.ImageIO.getImageReadersBySuffix(ext);
>                 if( it.hasNext() ){
>                     /* Use the first available ImageIO loader */
>                     retValue = fo;
>                     getExtensions().addExtension(ext);
>                 } else
>                     notSupportedExtensions.add (ext);
Comment 2 _ rkubacki 2004-08-31 13:36:00 UTC
Thanks, time spent in ImageDataLoader is significantly reduced now.