Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Performance pass on the tag plugin, measured on a seeded e2e database (2,000 tickets, 2,000 computers, 1,000 tags, 50,238 tag links; hot items carrying 600 tags, one tag linked to 2,032 items).
Server time of the "Associated items" tab: 115 → 62 ms (significant over 5 runs). Other page timings are within run-to-run noise on a local database; the query reductions matter most on a remote database.
Changes
Plugin::isPluginActive()database lookups and no configuration read on every request (Plugin::getPlugins()with a fallback when no plugin is booted); the tags location is read only when a form can show tags.getFromDB()per tag; no query for new items; the available tags are memoized per search criteria for the request.canItemtype(): the itemtypes of active tags are read once per request (reset on tag add/update/purge, migration, uninstall).plugin_tag_tags_idkey onglpi_plugin_tag_tagitems(install and migration), used by every lookup by tag.deleteByCriteria().PluginTagTag::getSingleTag()was removed (no remaining caller).Tests
TagTestCase::setUp()resets the memoized values between tests.Screenshots (if appropriate):