Details
-
Improvement
-
Resolution: Fixed
-
Major
-
18.9.0-rc-1
-
Unit
-
Unknown
-
N/A
-
N/A
-
Description
UI extension parameters are evaluated with Velocity for each request: for every UI extension with at least one parameter, the parameters are evaluated inside an author executor, with a Velocity context whose script context is re-initialized by every script context initializer, and each value is parsed again on every evaluation, even plain text. Profiling showed that this is roughly 10% of the time of a simple page request, mostly because of the about 30 org.xwiki.platform.requirejs.module UI extensions whose parameters javascript.vm reads on every page view, and the menu, drawer and docextra UI extensions.
Most parameter values don't need Velocity: in the UI extensions of XWiki Standard, 73% of the values contain no Velocity at all, and most of the others are a single call to $services.localization.render('key') or $services.webjars.url('webjarId', 'path').
The evaluation should:
- return values without Velocity as they are, without checking rights, setting up Velocity or caching anything,
- execute values that consist of literal text around a single $services.localization.render, $services.webjars.url or $xwiki.getSkinFile call with string literal arguments directly in Java, still only when the author of the UI extension has script right,
- compile the other values once and only set up Velocity when at least one value of a UI extension needs it.
After this change, only 4 of the UI extensions read by javascript.vm on every page still need Velocity.
Attachments
Issue Links
- is related to
-
XWIKI-21330 Wiki UI extension parameters aren't thread-safe
-
- Closed
-