Skip to content

KB perf "quick wins" - #25247

Merged
trasher merged 5 commits into
glpi-project:mainfrom
AdrienClairembault:kb-perf-quick-wins
Aug 25, 2026
Merged

KB perf "quick wins"#25247
trasher merged 5 commits into
glpi-project:mainfrom
AdrienClairembault:kb-perf-quick-wins

Conversation

@AdrienClairembault

Copy link
Copy Markdown
Member

Small KB changes that do not impact any features and improved a bit performances and memory usage.

@AdrienClairembault
AdrienClairembault marked this pull request as ready for review August 24, 2026 14:16
'knowbaseitems_id_parent' => $visible_ids,
],
]) as $link) {
foreach ($DB->request(['FROM' => KnowbaseItem_KnowbaseItem::getTable()]) as $link) {

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.

Suggested change
foreach ($DB->request(['FROM' => KnowbaseItem_KnowbaseItem::getTable()]) as $link) {
$links = $DB->request(['FROM' => KnowbaseItem_KnowbaseItem::getTable()]);
foreach ($links as $link) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

What's wrong with this?

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.

It's far better for performances to not call "costly" methods in a foreach loop

@trasher
trasher merged commit 02d00f8 into glpi-project:main Aug 25, 2026
13 checks passed
@AdrienClairembault
AdrienClairembault deleted the kb-perf-quick-wins branch August 25, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants