This issue has been created
There are 3 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-6b1c82b1-a448-4388-9e04-7cf2a668fb59 XWIKI-25421 Open

Avoid Velocity for UI extension parameters that don't need it

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-c5df8518-a7b8-4f6e-99d7-9a6128e356ed Michael Hamann created this issue on 20/Oct/26 12:32
 
Summary: Avoid Velocity for UI extension parameters that don't need it
Issue Type: cid:jira-generated-image-avatar-6b1c82b1-a448-4388-9e04-7cf2a668fb59 Improvement
Affects Versions: 18.9.0-rc-1
Assignee: Unassigned
Components: UI Extension
Created: 20/Oct/26 12:32
Priority: cid:jira-generated-image-static-major-f6dd4dcc-4ce3-4149-9797-e46e7cfdf3e3 Major
Reporter: Michael Hamann
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.

 
 

3 updates

 
cid:jira-generated-image-avatar-c5df8518-a7b8-4f6e-99d7-9a6128e356ed Changes by Michael Hamann on 20/Oct/26 12:33
 
Fix Version: 18.10.0-rc-1
Assignee: Michael Hamann
Labels: performance