Skip to content

Faster dataset copy in DB - #386

Open
btry wants to merge 1 commit into
pluginsGLPI:12.0/bugfixesfrom
btry:perf/install_data
Open

btry wants to merge 1 commit into
pluginsGLPI:12.0/bugfixesfrom
btry:perf/install_data

Conversation

@btry

@btry btry commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Measured on my slow computer :
before: approx 130s
after: approx 30s

www-data@2374c473e5c5:/var/www/glpi$ ./perf.sh ./bin/console plugin:install carbon -u glpi
Traitement du plugin « carbon »...
Writing fallback carbon intensity data
 6333/6333 [============================] 100%
Le plugin « carbon » a été installé et peut être activé.

Execution time: 135.815 seconds
www-data@2374c473e5c5:/var/www/glpi$ ./bin/console plugin:uninstall carbon
Cette action va supprimer des données de manière définitive
Voulez-vous continuer ? [Yes/no]y
Traitement du plugin « carbon »...
Le plugin « carbon » a été désinstallé.
www-data@2374c473e5c5:/var/www/glpi$ ./perf.sh ./bin/console plugin:install carbon -u glpi
Traitement du plugin « carbon »...
Writing fallback carbon intensity data
 6333/6333 [============================] 100%
Le plugin « carbon » a été installé et peut être activé.

Execution time: 28.962 seconds

@btry btry self-assigned this Oct 15, 2026
@btry btry added the enhancement New feature or request label Oct 15, 2026
@btry
btry changed the base branch from develop to 12.0/bugfixes October 15, 2026 08:01
@btry
btry requested a review from Rom1-B October 15, 2026 08:01
Comment on lines +108 to 114
if (!isset($cache_zones[$code])) {
$zone_id = Install::getOrCreateZone($entity, $source_id);
$cache_zones[$code] = $zone_id;
} else {
$zone_id = $cache_zones[$code];
}
Install::linkSourceZone($source_id, $zone_id, $code);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linkSourceZone() only needs one call per zone.

Suggested change
if (!isset($cache_zones[$code])) {
$zone_id = Install::getOrCreateZone($entity, $source_id);
$cache_zones[$code] = $zone_id;
} else {
$zone_id = $cache_zones[$code];
}
Install::linkSourceZone($source_id, $zone_id, $code);
if (!isset($cache_zones[$code])) {
$cache_zones[$code] = Install::getOrCreateZone($entity, $source_id);
Install::linkSourceZone($source_id, $cache_zones[$code], $code);
}
$zone_id = $cache_zones[$code];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants