xbps_transaction_*: multiple performance improvements (v2).
This commit implements multiple performance improvements to the transaction code: - Don't process xbps_pkg_name() N times each time we access its package dictionary (via pkgdb or rpool), just do it once at xbps_pkgdb_init() time. At pkgdb init time, it just creates a property in pkgdb, "pkgname". At rpool time, each time a package is accessed, the "pkgname" string property is added. - The package transaction dictionary contains the "transaction" object to know what's the pkg type. This has been changed to an uint8, this simplifies the logic and it's faster than checking a string object. See xbps_trans_type_t and xbps_transaction_pkg_type(). - Fixed the issue that was marked with XXX in transaction shlibs checking code. This has been fixed and improved and resources are now just freed as expected. - Simplified random code all over the place, avoiding unnecessary allocations or operations. - Rename some transaction files to have a better description. This is my first rototill to the code in 2020.
This commit is contained in:
@ -99,7 +99,7 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user)
|
||||
xbps_dbg_printf(xhp, " %s skipped (!automatic)\n", pkgver);
|
||||
continue;
|
||||
}
|
||||
if (xbps_find_pkg_in_array(array, pkgver, NULL)) {
|
||||
if (xbps_find_pkg_in_array(array, pkgver, 0)) {
|
||||
xbps_dbg_printf(xhp, " %s orphan (queued)\n", pkgver);
|
||||
continue;
|
||||
}
|
||||
@ -117,7 +117,7 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user)
|
||||
const char *revdepver;
|
||||
|
||||
xbps_array_get_cstring_nocopy(revdeps, i, &revdepver);
|
||||
if (xbps_find_pkg_in_array(array, revdepver, NULL))
|
||||
if (xbps_find_pkg_in_array(array, revdepver, 0))
|
||||
cnt++;
|
||||
}
|
||||
if (cnt == revdepscnt) {
|
||||
@ -173,7 +173,7 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user)
|
||||
|
||||
cnt = 0;
|
||||
xbps_array_get_cstring_nocopy(rdeps, x, &deppkgver);
|
||||
if (xbps_find_pkg_in_array(array, deppkgver, NULL)) {
|
||||
if (xbps_find_pkg_in_array(array, deppkgver, 0)) {
|
||||
xbps_dbg_printf(xhp, " rdep %s already queued\n", deppkgver);
|
||||
continue;
|
||||
}
|
||||
@ -191,7 +191,7 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user)
|
||||
|
||||
xbps_array_get_cstring_nocopy(reqby, j, &reqbydep);
|
||||
xbps_dbg_printf(xhp, " %s processing revdep %s\n", pkgver, reqbydep);
|
||||
if (xbps_find_pkg_in_array(array, reqbydep, NULL))
|
||||
if (xbps_find_pkg_in_array(array, reqbydep, 0))
|
||||
cnt++;
|
||||
}
|
||||
if (cnt == reqbycnt) {
|
||||
|
Reference in New Issue
Block a user