Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 572277

Summary: [performance] improve Util.getResourceContentsAsCharArray
Product: [Eclipse Project] JDT Reporter: Jörg Kubitz <jkubitz-eclipse>
Component: CoreAssignee: Jörg Kubitz <jkubitz-eclipse>
Status: VERIFIED FIXED QA Contact: Fabrice Tiercelin <fabrice.tiercelin>
Severity: minor    
Priority: P3 CC: fabrice.tiercelin, jarthana, loskutov, manoj.palat, sarika.sinha
Version: 4.20   
Target Milestone: 4.21 M1   
Hardware: All   
OS: Windows All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=572282
https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/178352
https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=141932dc82a2da30d55c83ad27de394755693779
https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/180024
https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/180025
https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=2685ba0b578528628dc5926cdffb1c0ebcdf7335
https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/180028
https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=e1b011bac4b199f0885077ad6276f5ee0ca86099
Whiteboard:

Description Jörg Kubitz CLA 2021-03-25 02:53:46 EDT
org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(IFile, String)
needlesly reads the filelength with a seperate OS file handle which costs totaly 1.1s in our full builds under windows.
The length is ignored (only used as initial guess) anyway because the size in bytes in meaningless when reading variable sized char encodings (bug 149028).
Comment 2 Sarika Sinha CLA 2021-04-29 23:56:03 EDT
This has caused warning in the build.
Comment 3 Eclipse Genie CLA 2021-04-30 00:00:02 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/180024
Comment 4 Manoj N Palat CLA 2021-04-30 01:23:45 EDT
(In reply to Sarika Sinha from comment #2)
> This has caused warning in the build.

Thanks @Sarika for checking this out - Reopening - please resolve once the gerrit is merged
Comment 5 Manoj N Palat CLA 2021-04-30 01:37:01 EDT
(In reply to Eclipse Genie from comment #1)
> Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/178352 was
> merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=141932dc82a2da30d55c83ad27de394755693779

This was targeted for 4.21 M1 and not 4.20. 
@Fabrice: Please include this target check as well when you do review so that we catch this before merge.
@Joerg: Please keep the perf/cleanup ones for M1 and not for other milestones.

Reverting.
Comment 6 Eclipse Genie CLA 2021-04-30 01:39:46 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/180025
Comment 8 Fabrice Tiercelin CLA 2021-04-30 01:51:08 EDT
> @Fabrice: Please include this target check as well when you do review so
> that we catch this before merge.

Got it
Comment 9 Eclipse Genie CLA 2021-04-30 02:56:09 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/180028
Comment 11 Jay Arthanareeswaran CLA 2021-07-07 04:33:32 EDT
Verified for 4.21 M1 by code inspection.