You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
During the v4l_uvc_device constructor it would call foreach_uvc_device in order to check if the constructed device is still connected.
It is very inefficient to search all devices to do find if 1 device is within the list.
This problem is them squared by the number of devices.
In this pr I have removed the check all together, as it is unlikely a newly found device would not be connected.
For the curious, I followed the source of why foreach_uvc_device is slow on high device count systems (>24).
It appears get_dev_capabilities tends too take up to 100ms on several open(/dev/videoXXX) calls, causing the total time of foreach_uvc_device to balloon out to ~3s.
Another note is that udev_device_watcher also lists devices on creation. Since this is a singleton its only called once. But it may be more efficient to use this cache for query_devices instead of calling direct to the source /dev/videoXXX, although potentially less accurate.
@aaron-evercoast Hi,
This code change seems valid, but we will have to make some more testing to see if any impact.
For example, if the user requests a device with a specific USB port / SN.
We will check and update.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
During the
v4l_uvc_device
constructor it would callforeach_uvc_device
in order to check if the constructed device is still connected.It is very inefficient to search all devices to do find if 1 device is within the list.
This problem is them squared by the number of devices.
In this pr I have removed the check all together, as it is unlikely a newly found device would not be connected.
For the curious, I followed the source of why
foreach_uvc_device
is slow on high device count systems (>24).It appears
get_dev_capabilities
tends too take up to 100ms on severalopen(/dev/videoXXX)
calls, causing the total time offoreach_uvc_device
to balloon out to ~3s.Another note is that
udev_device_watcher
also lists devices on creation. Since this is a singleton its only called once. But it may be more efficient to use this cache forquery_devices
instead of calling direct to the source/dev/videoXXX
, although potentially less accurate.