DIPlib / diplib

Quantitative Image Analysis in C++, MATLAB and Python
https://diplib.org
Apache License 2.0
222 stars 49 forks source link

Don't try loading javaio until needed. #128

Closed anntzer closed 1 year ago

anntzer commented 1 year ago

This can speed up the initial import of diplib ~2x. Note that the cost of import is never paid if the user never calls ImageRead (e.g. because they are already using an external library such as imageio).

(Somewhat similar in idea to #127.)

Note that this technically breaks backcompat by removing the hasDIPjavaio and javaioError globals. If keeping them is important, they can still be generated using a module-level __getattr__ (so that again we try to load the jvm only when really needed), just let me know.

crisluengo commented 1 year ago

This looks good, thank you! I will take a closer look tonight and merge.

crisluengo commented 1 year ago

I'm not sure how important hasDIPjavaio is, if someone out there is using it or not -- but it wasn't documented...