Skip to content

OpenCV core shared library load speed is extremely slow #24825

@brr53

Description

@brr53

System Information

Operating System / Platform: Ubuntu 20.04
Operating System / Platform: Windows 10
Operating System / Platform: MacOS Monterey

Have tried all sorts of OS.
Have tried both pre built versions of OpenCV and building myself.
Have tried release and non optimized builds.

Detailed description

Simply loading the OpenCV core library is slow in all programming languages.
Even though the dll/dylib is only 3MB, it takes as much as 200ms to load it.
This is very unusual as other libraries that are over 10MB take 0-1ms.

This load speed is very important for use case such in mobile apps.
I understand OpenCV is feature complex, so, I have isolated it to just the core. Many uses of OpenCV only involve resizing of images, so it would be beneficial to understand why simply loading it takes so long.

I have attached an example dylib that was compiled on my M1 Macbook.
libopencv_core.4.9.0.dylib.zip

Steps to reproduce

System.load("path_to_dll_or_dylib");

You can load it any way you like in any programming language. It will be the same.

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions