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

Long loading time Loader.load(org.bytedeco.opencv.opencv_java.class); #1638

Closed
JimmySimard opened this issue Apr 27, 2021 · 13 comments
Closed

Comments

@JimmySimard
Copy link

When I load the library on startup it take about 30 seconds to finish the loading,,, Is there a way to remove some library to reduce the loading time or something else?

@saudet
Copy link
Member

saudet commented Apr 27, 2021

This has been fixed with JavaCPP 1.5.5. Please try again with JavaCV 1.5.5.

@JimmySimard
Copy link
Author

Thank you for quick answer ! After updgrading to the lastest version, I have save around 15 seconds. Do you think I can do better or it is the best ?

@saudet
Copy link
Member

saudet commented Apr 27, 2021

Please set the "org.bytedeco.javacpp.logger.debug" system property to "true", and look at the messages displayed on the console. We should be able to tell that way which DLLs are taking so long to load.

@JimmySimard
Copy link
Author

Sorry for the delay... I have run the application with the debug flag on and as you say I see all the dll been loaded but none of them take much time ! What seem to be long is the fact that a lot of dll are loaded ! I have excluded some jar from the javacv maven dependency to reduce loading time but no luck ... I imagine it's the best i can do !

@saudet
Copy link
Member

saudet commented May 3, 2021

What do you mean by "a lot"? Could you attach the whole log here?

@JimmySimard
Copy link
Author

This the console log output. You will see what I mean by a lot !

console_log.txt

@saudet
Copy link
Member

saudet commented May 6, 2021

Thanks for testing! The same classes and DLLs get loaded for me as well, and on my installation of Windows 10, calling Loader.load(org.bytedeco.opencv.opencv_java.class); takes only about 1000 ms to execute. Since I can't reproduce this issue here, I will not be able to fix it without additional information, but there is at least one other user that is experiencing the same slow loading time on Windows, see bytedeco/javacpp#452, so I'll mark this as a duplicate of that, and let's continue the discussion there.

@saudet
Copy link
Member

saudet commented May 6, 2021

Duplicate of bytedeco/javacpp#452

@saudet
Copy link
Member

saudet commented Jan 25, 2022

I've done some further optimizations in commit bytedeco/javacpp@e8b5734 that should pretty much fix any regression in loading time on Windows.

Please give it a try with the snapshots: http://bytedeco.org/builds/

@JimmySimard
Copy link
Author

I've just done some tests with your snapshot ! The starting time has past from 20 seconds to only 4 seconds ! Thank you !

@saudet
Copy link
Member

saudet commented Jan 28, 2022

4 seconds is still a lot of time though. I wonder what's going on there. Would you have any ideas @HannesWell?

@HannesWell
Copy link

4 seconds is still a lot of time though. I wonder what's going on there. Would you have any ideas @HannesWell?

Not immediately but I can consider this case when looking for further optimizations of the Loader. The more cases I have and the long they the better I can find more hot spots in the code.

What was the exact use case? Did you only call the code mentioned in the title?
Loader.load(org.bytedeco.opencv.opencv_java.class);

@saudet can you tell me the largest preset to load? Alternatively I could just load multiple libraries.

@saudet
Copy link
Member

saudet commented Jan 30, 2022

I think the one that takes the most time is SciPy, see bytedeco/javacpp#512 (comment). The issue with Python libraries is that they have a lot of small files that we have to extract and NTFS is not particularly optimized for this use case.

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

No branches or pull requests

3 participants