Re: [PR] Fb perf [geronimo-xbean]
struberg (via GitHub) <[email protected]> Mon, 06 Jul 2026 18:14:36 -0000
| Newsgroups | gmane.comp.java.geronimo.devel |
|---|---|
| Message-ID | <PR_kwDOAAOrUs7ubJnH-91d0fe67-9173-4184-b159-9192ada2413c@gitbox.apache.org> |
struberg commented on code in PR #57:
URL: https://github.com/apache/geronimo-xbean/pull/57#discussion_r3531125006
##########
xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java:
##########
@@ -162,36 +157,36 @@ protected Class<?> loadClass(String fixedName) throws ClassNotFoundException {
- private List<String> file(URL location) {
- List<String> classNames = new ArrayList<String>();
+ private void file(URL location) throws IOException {
File dir = new File(URLDecoder.decode(location.getPath()));
if (dir.getName().equals("META-INF")) {
dir = dir.getParentFile(); // Scrape "META-INF" off
}
if (dir.isDirectory()) {
- scanDir(dir, classNames, "");
+ scanDir(dir);
}
- return classNames;
}
- private void scanDir(File dir, List<String> classNames, String packageName) {
+ private void scanDir(File dir) throws IOException {
File[] files = dir.listFiles();
if (files == null) {
return;
}
for (File file : files) {
if (file.isDirectory()) {
- scanDir(file, classNames, packageName + file.getName() + ".");
+ scanDir(file);
} else if (file.getName().endsWith(".class")) {
- String name = file.getName();
- name = name.replaceFirst(".class$", "");
- if (name.contains(".")) continue;
Review Comment:
now solved with a
```
if (name.indexOf('.') != name.length()-6) {
continue;
}
```
This has the benefit of not performing a potential memory allocation but only reading in the mem.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe-nmThH5wfGryY1pf4d8vP8EB+6BGkLq7r@public.gmane.org
For queries about this service, please contact Infrastructure at:
users-pF6z+fRhj9EyzMRdD/[email protected]