Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[performance] avoid File.getCanonicalPath() #3432

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

jukzi
Copy link
Contributor

@jukzi jukzi commented Dec 10, 2024

File.getCanonicalPath() is a IO Operation that is costly especially on windows OS.
Instead use a NON-IO .toPath().normalize().toAbsolutePath().toString()

https://bugs.eclipse.org/bugs/show_bug.cgi?id=571614

@jukzi jukzi added Windows Happens on Windows OS performance labels Dec 10, 2024
@eclipse-jdt-bot
Copy link
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF
org.eclipse.jdt.compiler.apt.tests/pom.xml
org.eclipse.jdt.compiler.tool.tests/META-INF/MANIFEST.MF
org.eclipse.jdt.compiler.tool.tests/pom.xml

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 0bcb12e9fb938929b0caace5658912157b32b550 Mon Sep 17 00:00:00 2001
From: Eclipse JDT Bot <jdt-bot@eclipse.org>
Date: Tue, 10 Dec 2024 11:20:55 +0000
Subject: [PATCH] Version bump(s) for 4.35 stream


diff --git a/org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF b/org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF
index 6ef32b06cf..7cac8a55de 100644
--- a/org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jdt.compiler.apt.tests;singleton:=true
-Bundle-Version: 1.3.600.qualifier
+Bundle-Version: 1.3.700.qualifier
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
 Bundle-RequiredExecutionEnvironment: JavaSE-17
diff --git a/org.eclipse.jdt.compiler.apt.tests/pom.xml b/org.eclipse.jdt.compiler.apt.tests/pom.xml
index 0675ac29f6..59e27d4176 100644
--- a/org.eclipse.jdt.compiler.apt.tests/pom.xml
+++ b/org.eclipse.jdt.compiler.apt.tests/pom.xml
@@ -19,7 +19,7 @@
     <relativePath>../tests-pom/</relativePath>
   </parent>
   <artifactId>org.eclipse.jdt.compiler.apt.tests</artifactId>
-  <version>1.3.600-SNAPSHOT</version>
+  <version>1.3.700-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 
   <properties>
diff --git a/org.eclipse.jdt.compiler.tool.tests/META-INF/MANIFEST.MF b/org.eclipse.jdt.compiler.tool.tests/META-INF/MANIFEST.MF
index 935a43ecfd..c5f3056e24 100644
--- a/org.eclipse.jdt.compiler.tool.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.compiler.tool.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jdt.compiler.tool.tests
-Bundle-Version: 1.4.600.qualifier
+Bundle-Version: 1.4.700.qualifier
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
 Bundle-RequiredExecutionEnvironment: JavaSE-17
diff --git a/org.eclipse.jdt.compiler.tool.tests/pom.xml b/org.eclipse.jdt.compiler.tool.tests/pom.xml
index 9f094788a4..06a6878a01 100644
--- a/org.eclipse.jdt.compiler.tool.tests/pom.xml
+++ b/org.eclipse.jdt.compiler.tool.tests/pom.xml
@@ -19,7 +19,7 @@
     <relativePath>../tests-pom/</relativePath>
   </parent>
   <artifactId>org.eclipse.jdt.compiler.tool.tests</artifactId>
-  <version>1.4.600-SNAPSHOT</version>
+  <version>1.4.700-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
   <properties>
   	<testSuite>${project.artifactId}</testSuite>
-- 
2.47.1

Further information are available in Common Build Issues - Missing version increments.

@jukzi
Copy link
Contributor Author

jukzi commented Dec 10, 2024

Found it as hotspot in org.eclipse.jdt.internal.compiler.batch.ClasspathDirectory. () while runnning NullTypeAnnotationTest
This PR reduces NullTypeAnnotationTest from 102 sec to 92 sec
image

image

jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this pull request Dec 10, 2024
File.getCanonicalPath() is a IO Operation that is costly especially on
windows OS.
Instead use a NON-IO .toPath().normalize().toAbsolutePath().toString()

https://bugs.eclipse.org/bugs/show_bug.cgi?id=571614
File.getCanonicalPath() is a IO Operation that is costly especially on
windows OS.
Instead use a NON-IO .toPath().normalize().toAbsolutePath().toString()

https://bugs.eclipse.org/bugs/show_bug.cgi?id=571614
@jukzi jukzi merged commit 17fc318 into eclipse-jdt:master Dec 16, 2024
10 checks passed
@jukzi jukzi deleted the getCanonicalPath branch December 16, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Windows Happens on Windows OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants