From 4562c35527c199e1ed9b41d78c0dd81c88c655c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 27 May 2020 15:49:17 +0200 Subject: core: store unit aliases in a separate set We allocated the names set for each unit, but in the majority of cases, we'd put only one name in the set: $ systemctl show --value -p Names '*'|grep .|grep -v ' '|wc -l 564 $ systemctl show --value -p Names '*'|grep .|grep ' '|wc -l 16 So let's add a separate .id field, and only store aliases in the set, and only create the set if there's at least one alias. This requires a bit of gymnastics in the code, but I think this optimization is worth the trouble, because we save one object for many loaded units. In particular set_complete_move() wasn't very useful because the target unit would always have at least one name defined, i.e. the optimization to move the whole set over would never fire. --- src/core/load-dropin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/load-dropin.h') diff --git a/src/core/load-dropin.h b/src/core/load-dropin.h index ea15554d88..5e2ec0d80a 100644 --- a/src/core/load-dropin.h +++ b/src/core/load-dropin.h @@ -13,7 +13,7 @@ static inline int unit_find_dropin_paths(Unit *u, char ***paths) { u->manager->lookup_paths.search_path, u->manager->unit_path_cache, ".d", ".conf", - u->names, + u->id, u->aliases, paths); } -- cgit v1.2.1