Skip to content

[DRAFT] Introduce faster (batched) LocalFile.childInfos() version#2779

Open
iloveeclipse wants to merge 2 commits into
eclipse-platform:masterfrom
iloveeclipse:faster_refresh
Open

[DRAFT] Introduce faster (batched) LocalFile.childInfos() version#2779
iloveeclipse wants to merge 2 commits into
eclipse-platform:masterfrom
iloveeclipse:faster_refresh

Conversation

@iloveeclipse

Copy link
Copy Markdown
Member

The code is supposed to speed up NFS file access on Linux by an order of magnitude by fetching directory children data (IFileInfo) in one shot from JNI (via array of StructStat).

LocalFile.childInfos(int, IProgressMonitor) overrides now the FileStore.childInfos(int, IProgressMonitor) on Linux with an optimized version.

No idea how to build binary for Mac without Mac.

@iloveeclipse iloveeclipse marked this pull request as ready for review June 19, 2026 15:26
@iloveeclipse iloveeclipse requested a review from Copilot June 19, 2026 15:27
@eclipse-platform-bot

eclipse-platform-bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

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

resources/bundles/org.eclipse.core.filesystem.linux.x86_64/META-INF/MANIFEST.MF
resources/bundles/org.eclipse.core.filesystem.linux.x86_64/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 dd7e38f08a42b45f24845bbe67948d8137f1f7f3 Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Fri, 19 Jun 2026 15:46:35 +0000
Subject: [PATCH] Version bump(s) for 4.41 stream


diff --git a/resources/bundles/org.eclipse.core.filesystem.linux.x86_64/META-INF/MANIFEST.MF b/resources/bundles/org.eclipse.core.filesystem.linux.x86_64/META-INF/MANIFEST.MF
index ada3f4f2ee..f37a72add7 100644
--- a/resources/bundles/org.eclipse.core.filesystem.linux.x86_64/META-INF/MANIFEST.MF
+++ b/resources/bundles/org.eclipse.core.filesystem.linux.x86_64/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %fragmentName
 Bundle-SymbolicName: org.eclipse.core.filesystem.linux.x86_64; singleton:=true
-Bundle-Version: 1.2.400.qualifier
+Bundle-Version: 1.2.500.qualifier
 Bundle-Vendor: %providerName
 Fragment-Host: org.eclipse.core.filesystem;bundle-version="[1.7.200,2.0.0)"
 Bundle-Localization: fragment
diff --git a/resources/bundles/org.eclipse.core.filesystem.linux.x86_64/pom.xml b/resources/bundles/org.eclipse.core.filesystem.linux.x86_64/pom.xml
index 1d83bb509f..3141d7d51d 100644
--- a/resources/bundles/org.eclipse.core.filesystem.linux.x86_64/pom.xml
+++ b/resources/bundles/org.eclipse.core.filesystem.linux.x86_64/pom.xml
@@ -18,7 +18,7 @@
     <relativePath>../../</relativePath>
   </parent>
   <artifactId>org.eclipse.core.filesystem.linux.x86_64</artifactId>
-  <version>1.2.400-SNAPSHOT</version>
+  <version>1.2.500-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <profiles>
-- 
2.54.0

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a faster directory-children enumeration path for LocalFile by adding JNI-backed directory listing APIs on Unix and wiring LocalFile.childInfos(...) / childNames(...) to use the new native handler entrypoints (intended to significantly speed up NFS access on Linux).

Changes:

  • Add NativeHandler/LocalFileNativesManager APIs for listing directory entry names and for listing + fetching IFileInfo in one pass.
  • Implement Unix-native listDir(...) and listDirAndGetFileInfos(...) JNI methods and extend StructStat to carry per-entry errno, name, and symlink target.
  • Override LocalFile.childInfos(...) to use the new batched native-backed listing path.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileNatives.java Adds Java wrappers for new JNI directory listing methods.
resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileHandler.java Exposes the new listing methods via the Unix native handler.
resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/StructStat.java Adds fields to carry name/errno/symlink target and adapts toFileInfo().
resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/NativeHandler.java Adds default (non-native) implementations for the new listing APIs.
resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNativesManager.java Adds manager-level entrypoints to call the new listing APIs.
resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFile.java Overrides childInfos(...) and routes both childInfos/childNames via the manager.
resources/bundles/org.eclipse.core.filesystem/natives/unix/unixfile.h Updates native signatures and declares new JNI functions.
resources/bundles/org.eclipse.core.filesystem/natives/unix/unixfile.c Implements listDir / listDirAndGetFileInfos and updates stat calls.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +436 to +440
/* Add the directory entry name to the names array */
nameString = (*env)->NewStringUTF(env, entry->d_name);
if (nameString == NULL) {
goto cleanup;
}
Comment on lines +578 to +580
} else if (statErrno == 0) {
statErrno = errno;
}
Comment on lines +40 to +43
if (errno != 0 && errno != ENOENT) {
info.setError(IFileInfo.IO_ERROR);
return info;
}
Comment on lines +611 to +613
nameString = (*env)->NewStringUTF(env, entry->d_name);
if (nameString == NULL) {
(*env)->DeleteLocalRef(env, statObject);
Comment on lines +582 to +585
if (linkPathLen >= 0) {
linkString = (*env)->NewStringUTF(env, linkPath);
} else {
linkString = (*env)->NewStringUTF(env, "");
The code is supposed to speed up NFS file access on Linux by an order of
magnitude by fetching directory children data (IFileInfo) in one shot
from JNI (via array of StructStat).

LocalFile.childInfos(int, IProgressMonitor) overrides now the
FileStore.childInfos(int, IProgressMonitor) on Linux with an optimized
version.

No idea how to build binary for Mac without Mac.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Comment on lines +575 to +580
linkPathLen = readlinkat(directoryFd, entry->d_name, linkPath, PATH_MAX);
if (linkPathLen >= 0) {
linkPath[linkPathLen] = '\0';
} else if (statErrno == 0) {
statErrno = errno;
}
info = stat.toFileInfo();
} else {
if (lstat(name, stat) == 0) { // return information about the link itself if the file is a symbolic link
if ((stat.st_mode & UnixFileFlags.S_IFMT) == UnixFileFlags.S_IFLNK) { // it a link!
Comment on lines 39 to +43
FileInfo info = new FileInfo();
info.setExists(true);
if (errno != 0 && errno != ENOENT) {
info.setError(IFileInfo.IO_ERROR);
return info;
}
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

    51 files   -   3      51 suites   - 3   1h 1m 30s ⏱️ + 7m 45s
 4 677 tests ±  0   3 530 ✅  - 1 125   22 💤 ± 0  229 ❌ +229  896 🔥 +896 
11 771 runs   - 154  10 760 ✅  - 1 012  114 💤  - 39  170 ❌ +170  727 🔥 +727 

For more details on these failures and errors, see this check.

Results for commit e913952. ± Comparison against base commit c45a7a7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants