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 190480

Summary: need for FileUtil.normalizePath
Product: platform Reporter: Vladimir Voskresensky <vv159170>
Component: FilesystemsAssignee: Vladimir Voskresensky <vv159170>
Status: RESOLVED FIXED    
Severity: normal CC: apireviews, issues, jglick, jtulach
Priority: P3 Keywords: API, API_REVIEW_FAST, PERFORMANCE
Version: 7.0   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: proposed patch
final patch

Description Vladimir Voskresensky 2010-09-21 12:55:47 UTC
To replace cnd version of cache for normalized files we need string-based 
FileUtil.normilizePath, because using File-based FileUtil.normilizeFile gives perf overhead due to not needed conversion path->file->path
Comment 1 Vladimir Voskresensky 2010-09-21 12:56:30 UTC
something like:
    public static String normalizePath(final String unnormalized) {
        Map<String, String> normalizedPaths = getNormalizedFilesMap();
        String normalized = normalizedPaths.get(unnormalized);
        if (normalized == null) {
            File ret = normalizeFileImpl(new File(unnormalized));
            normalized = ret.getPath();
            normalizedPaths.put(unnormalized, normalized);            
        }
        return normalized;
    }
Comment 2 Vladimir Voskresensky 2010-09-22 06:01:26 UTC
we need this in 6.10 to save quite a few memory (duplicated caches). I will prepare a patch for API review
Comment 3 Vladimir Voskresensky 2010-09-22 09:03:46 UTC
Created attachment 102113 [details]
proposed patch
Comment 4 Vladimir Voskresensky 2010-09-22 09:11:47 UTC
Please, review proposed patch
Comment 5 Jesse Glick 2010-09-22 13:34:09 UTC
Generally looks good. Minor comments:


[JG01] "that does prevent String to File to String conversion" - probably you mean "that does not require String to File to String conversion"?


[JG02] The date of the change is set as the 22nd, today. Be sure to commit with the date it is actually committed. My custom is to submit a patch with a date seven days from today, i.e. assuming the review will pass on time.


[JG03] nP Javadoc should just @see nF Javadoc for all details, so we do not have to maintain two copies of a complex specification.
Comment 6 Vladimir Voskresensky 2010-09-22 13:56:14 UTC
(In reply to comment #5)
> Generally looks good. Minor comments:
> 
> 
> [JG01] "that does prevent String to File to String conversion" - probably you
> mean "that does not require String to File to String conversion"?
I was not sure about right wording. 
The main idea is that if "client" is working with pure strings and is trying to prevent performance overhead "string to file to string conversion" (cnd's usecase) => he can use nP instead of nF.
May be you can propose even better description? 
> 
> 
> [JG02] The date of the change is set as the 22nd, today. Be sure to commit with
> the date it is actually committed. My custom is to submit a patch with a date
> seven days from today, i.e. assuming the review will pass on time.
Ok. will be correct date.

> 
> 
> [JG03] nP Javadoc should just @see nF Javadoc for all details, so we do not
> have to maintain two copies of a complex specification.
Good idea.

Thanks.
Comment 7 Jesse Glick 2010-09-22 14:15:21 UTC
(In reply to comment #6)
> May be you can propose even better description? 

I think the wording I already proposed is what you want. The new method does not prevent conversion when there is a cache miss - but it does not require conversion when there is a cache hit.
Comment 8 Vladimir Voskresensky 2010-09-29 18:49:37 UTC
Created attachment 102200 [details]
final patch

will apply tomorrow
Comment 9 Jesse Glick 2010-09-29 22:10:17 UTC
Rather than

  @see normalizeFile for details

use

  See {@link #normalizeFile} for details.

or

  @see #normalizeFile
Comment 10 Vladimir Voskresensky 2010-09-29 22:18:35 UTC
(In reply to comment #9)
> Rather than
> 
>   @see normalizeFile for details
> 
> use
> 
>   See {@link #normalizeFile} for details.
Ok. Will use this variant
Thanks
Comment 11 Vladimir Voskresensky 2010-09-30 07:51:01 UTC
integrated
http://hg.netbeans.org/cnd-main/rev/4d11cccea60b

Thanks for review