Cache markdown extensions

Created on 8 February 2023, over 1 year ago
Updated 9 June 2023, about 1 year ago

Problem/Motivation

Performance hit with large tables.

Steps to reproduce

Make a large table.

Open /src/Listener/ExtendedMarkdown.php and time how long line 58 takes:

$extensions = $this->getExtensions();

I used Devel and wrapped it like this:

$ex = hrtime(true);
$extensions = $this->getExtensions();
dpm((hrtime(true) - $ex)/1000000000, 'ex');

Then clear cache and load the page with the table.

I found that extensions were loaded once for each cell in my table and that this method call took about 0.25 seconds each. It quickly added up.

Proposed resolution

I don't think we really need a new instance of extensions for each cell processed, so we can just cache them the first time they are requested.

Remaining tasks

Cache extensions.

User interface changes

none

API changes

none

Data model changes

none

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bander2

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024