Skip to content
Snippets Groups Projects
Commit 6ff2f918 authored by Papoteur's avatar Papoteur Committed by Neal Gompa (ニール・ゴンパ)
Browse files

Improve time spent in _get_id.

Before the modification, this function represents 35% of the time spent in get_packages.
After, it is just 30%
parent fcb5d69a
No related branches found
No related tags found
No related merge requests found
...@@ -1061,11 +1061,10 @@ class DnfDaemonBase(dbus.service.Object, DownloadCallback): ...@@ -1061,11 +1061,10 @@ class DnfDaemonBase(dbus.service.Object, DownloadCallback):
def _get_id(self, pkg): def _get_id(self, pkg):
"""Get a package id from a given package.""" """Get a package id from a given package."""
values = [pkg.name, str(pkg.epoch), pkg.version, pkg.release, pkg.arch]
if callable(pkg.ui_from_repo): if callable(pkg.ui_from_repo):
values.append(pkg.ui_from_repo()) values = [pkg.name, str(pkg.epoch), pkg.version, pkg.release, pkg.arch, pkg.ui_from_repo()]
else: else:
values.append(pkg.ui_from_repo) values = [pkg.name, str(pkg.epoch), pkg.version, pkg.release, pkg.arch, pkg.ui_from_repo]
return ",".join(values) return ",".join(values)
def _get_action(self, po): def _get_action(self, po):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment