Bug 190480 - need for FileUtil.normalizePath
need for FileUtil.normalizePath
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: Filesystems
7.0
All All
: P3 (vote)
: 7.0
Assigned To: Vladimir Voskresensky
issues@platform
cndreq
: API, API_REVIEW_FAST, PERFORMANCE
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-21 12:55 UTC by Vladimir Voskresensky
Modified: 2010-09-30 07:51 UTC (History)
4 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
proposed patch (8.42 KB, patch)
2010-09-22 09:03 UTC, Vladimir Voskresensky
Details | Diff
final patch (7.45 KB, patch)
2010-09-29 18:49 UTC, Vladimir Voskresensky
Details | Diff

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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo