Repository navigation
Conversation
MyvTsv
marked this pull request as ready for review
November 16, 2026 13:12
Rom1-B
requested review from
a team,
Herafia,
Mary-Clb and
RomainLvr
and removed request for
a team
November 18, 2026 14:36
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 pdf plugin, measured on a seeded e2e database (2,000 tickets, 2,000 computers, 20,000 followups, 10,000 tasks, 50,000 installed software versions, 10,000 network ports, 100,000 history lines). Hot ticket with 500 followups, 250 tasks, 50 costs and 50 validations; hot computer with 1,250 installed software versions, 100 license assignments and 250 network ports.
SQL time of the export: ticket 154 → 32 ms, computer 415 → 104 ms. Fully loaded: ticket export 2,550 → 1,580 ms, computer export 3,520 → 2,565 ms; both gains are significant over 5 runs. On the item forms and the "PDF export" tab, the plugin cost was already within the noise and stays so.
Changes
PluginPdfSimplePDF::displayInternal()): each row used to be rendered twice by TCPDF, a dry run in a transaction to compute its height and then the real write. That accounted for 85 to 95 % of the export CPU. One-column rows are now written once. In multi-column rows, cells holding one line of plain text are measured withgetStringHeight(), and only the other cells (markup, wrapping, empty) still go through the dry run.front/export.phpandfront/export.massive.phpcallSession::writeClose()once the rights are checked, just before the generation. A long or massive export no longer freezes the user's other tabs.PluginPdfCommon::getUserNameCached()andgetDropdownNameCached(). Before, the export looked them up once per row: 1,259 user queries for 25 distinct users.PluginPdfConfig::formatNumber(): theNumberFormatteris built once per user and request. It no longer reads the language configuration and the user for each amount.getDevices()reuses the global$PDF_DEVICES.PluginPdfItem_SoftwareVersion): all licenses of the item are read in one query and grouped by version, instead of one query per installed version (1,250 → 1).PluginPdfNetworkPort): the port query also selectsinstantiation_typeandmac, so each port is no longer re-read withgetFromDB()(-250 queries).Plugin::isActivated('datainjection' / 'geststock')queriedglpi_pluginson every request, because plugins are not flagged as initialized yet inplugin_init_pdf. The check moved topost_initand usesPlugin::getPlugins(), the list built by core at boot.No schema change.
Notes
pdftotext -bbox) before and after: same pages, same words, same horizontal positions. One layout difference: a multi-column row that starts a page is now printed at the top margin, about 5 pt higher than before. The old offset was an artefact of the dry run.Session::writeClose()keeps the session open, so the export still holds the session lock there.Tests
front/export.massive.php) generates the PDF with the session released.