FFE: Switch from apt to apt_pkg bindings

Bug #1963712 reported by Alberto Milone
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-drivers-common (Ubuntu)
Fix Released
Medium
Alberto Milone

Bug Description

Switch from the apt bindings to the apt_pkg bindings for the ubuntu-drivers tool.

This significantly improves performance (2,673s vs 13,751s , on my dated Intel Ivy Bridge i7-3770K CPU).

[Attach sbuild log]

[Performance data]
system_driver_packages() performance for a lot of modaliases ... [0.94 s] ok
system_driver_packages() performance for a lot of modaliases ... [0.96 s] ok

Old detection code:

:~$ time ubuntu-drivers list
nvidia-driver-510, (kernel modules provided by linux-modules-nvidia-510-generic-hwe-20.04)
nvidia-driver-470, (kernel modules provided by linux-modules-nvidia-470-generic-hwe-20.04)
nvidia-driver-470-server, (kernel modules provided by linux-modules-nvidia-470-server-generic-hwe-20.04)

real 0m13,751s
user 0m13,480s
sys 0m0,258s

:~$ time ubuntu-drivers list
nvidia-driver-510, (kernel modules provided by linux-modules-nvidia-510-generic-hwe-20.04)
nvidia-driver-470-server, (kernel modules provided by linux-modules-nvidia-470-server-generic-hwe-20.04)
nvidia-driver-470, (kernel modules provided by linux-modules-nvidia-470-generic-hwe-20.04)

real 0m13,785s
user 0m13,578s
sys 0m0,196s

New detection code:

:~$ time ubuntu-drivers list
nvidia-driver-470, (kernel modules provided by linux-modules-nvidia-470-generic-hwe-20.04)
nvidia-driver-470-server, (kernel modules provided by linux-modules-nvidia-470-server-generic-hwe-20.04)
nvidia-driver-510, (kernel modules provided by linux-modules-nvidia-510-generic-hwe-20.04)

real 0m2,673s
user 0m1,749s
sys 0m0,914s

:~$ time ubuntu-drivers list
nvidia-driver-470-server, (kernel modules provided by linux-modules-nvidia-470-server-generic-hwe-20.04)
nvidia-driver-510, (kernel modules provided by linux-modules-nvidia-510-generic-hwe-20.04)
nvidia-driver-470, (kernel modules provided by linux-modules-nvidia-470-generic-hwe-20.04)

real 0m2,645s
user 0m1,702s
sys 0m0,935s

[PR]
https://github.com/tseliot/ubuntu-drivers-common/pull/68

[PPA]
https://launchpad.net/~albertomilone/+archive/ubuntu/u-d-c-lp1963712

Changed in ubuntu-drivers-common (Ubuntu):
importance: Undecided → Medium
description: updated
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello Alberto! Thank you for filling in the FFe! Did you do a test-build of the change on some PPA that we could take a look at? And did you do a test install of the test packages so that you could provide some logs? The changes seem on one side simple, but touch a lot of the code, so I'm obviously a bit worried about any bumps. How noticeable is the performance improvement? Has this been measured? Just trying to assess the risk-to-merit ratio here ;)

Changed in ubuntu-drivers-common (Ubuntu):
status: Confirmed → Incomplete
description: updated
description: updated
Revision history for this message
Alberto Milone (albertomilone) wrote :
Changed in ubuntu-drivers-common (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Alberto Milone (albertomilone) wrote :

Hi Łukasz, I have just attached the sbuild log. I can certainly upload to a PPA, so that, perhaps, testing the changes will be easier.

As I wrote in the description, I saw the time for a simple "ubuntu-drivers list" go down from 13,751s to 2,673s, which is quite impressive.

Revision history for this message
Alberto Milone (albertomilone) wrote :

I have also added a PPA in the description.

description: updated
Revision history for this message
Alberto Milone (albertomilone) wrote :

I have addressed all the concerns in the PR, and I have uploaded the changes to the PPA.

Revision history for this message
Alberto Milone (albertomilone) wrote :

Here is the output and the time it takes to run ubuntu-drivers list and ubuntu-drivers list --gpgpu

Revision history for this message
Alberto Milone (albertomilone) wrote :

Output of ubuntu-drivers debug

Revision history for this message
Alberto Milone (albertomilone) wrote :

Here is the output of ubuntu-drivers install, however I was not able measure the time here. The packages were installed correctly.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Ok, I think this convinced me enough for a +1. Please proceed! Let's make sure this gets released before Beta.

Changed in ubuntu-drivers-common (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Alberto Milone (albertomilone) wrote :

Ok, I have just uploaded the new u-d-c. Thanks

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-drivers-common - 1:0.9.6

---------------
ubuntu-drivers-common (1:0.9.6) jammy; urgency=medium

  * Drop apt in favour of the apt_pkg bindings (LP: #1963712).

 -- Alberto Milone <email address hidden> Mon, 14 Mar 2022 12:15:38 +0100

Changed in ubuntu-drivers-common (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Sebastien Bacher (seb128) wrote :

bug #1964880 seems a regression due to the update

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.