apache / apache/netbeans

JarClassLoader performance could be enhanced

Open
#3,838 1 comment 0 reactions 0 assignees View on GitHub
Contribution welcome kind:feature performance Platform
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Description

Currently the JarClassloader is kind of slow. It iterates over ALL present jars, when queried for ressources or classes. This leads to drastic perfomance losses with lots of jars and many resource requests. There is no caching.

### Use case/motivation

In our netbeans platform project Hibernate initialisation takes 40 seconds (compared to the same initialisiation in a Unit test which takes 4 seconds). Hibernates looks for a lot of SPI Lookups and Flyway looks for sql migratrion files for example.

We made our own adapted version of the JarClassloader which remembers which classes/resources are located in which jars and this improved perfoamce drastically for the whole application. This approach might not be feasibly for the netbeans product as such but it shows that there is room for performance improvements.

### Related issues

_No response_

### Are you willing to submit a PR?

- [ ] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow the Apache Software Foundation's [Code of Conduct](https://www.apache.org/foundation/policies/conduct.html)

Contributor guide

Open the contributing guide

Research direction

Start at the JarClassLoader entry point and trace how class and resource requests iterate over present JARs; the issue provides no file or test name. Compare behavior using the Hibernate initialization and Flyway migration lookup examples, and define completion around a measured reduction in lookup time without breaking class or resource discovery.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
performance, tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.