Project

General

Profile

Actions

Defect #44348

open

Formatting a text is much slower in 7.0.0 when its container has many attachments

Added by Go MAEDA about 17 hours ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Performance
Target version:
Resolution:
Affected version:

Description

Since 7.0.0, formatting text takes much longer when its container has many attachments. This affects everything rendered through ApplicationHelper#textilizable: wiki pages, issue descriptions and notes, forum messages, news, and documents.

The reason is that Formatter#to_html calls the expensive post_processor_scrubbers method inside the loop that runs once per HTML node. This seems to be a regression introduced by #43745.

Formatting text with 123 nodes in a container with 100 attachments, measured with the attached benchmark script:

  6.1.3, Ruby 3.2.2        3.2 ms   10565 objects allocated
  7.0.0, Ruby 3.4.8       29.4 ms   25052 objects allocated
  7.0.0 with the patch     2.9 ms   13286 objects allocated

The attached patch builds the scrubbers once per text instead of once per node. This restores the rendering time to the 6.1 level. Text with no attachments is unaffected. The Textile formatter has the same problem and is fixed in the same way.


Files

No data to display

Actions

Also available in: Atom PDF