New contrib extension: Formula pre-caching listener

Hello everyone,

I’d like to create a new contrib extension called “Formula pre-caching listener”.

Currently, the formula macro has a mechanism to cache the results of a formula evaluation based on the contents of the macro. The cache works by storing the image produced by the macro in the XWiki temp directory, with a name based on a hash of the macro contents and parameters. Thus, if the macro gets reloaded, the rendered image of the macro is already available.

This is already a very useful option, as, while the first load of a page containing many formula macros will take some time, the second reload won’t take as much time as every formula is now in cache.

This extension aims to remove the need for a user to actually wait for the first load a page which contains a lot of formula macros. This is particularly useful in an environment where XWiki gets restarted frequently for different reasons (and thus looses its cache), or simply where the user does not want to wait a long time for the first load of a document.

I’ll create the GitHub repos + the JIRA project.

Thanks,
Clément

Repository created : GitHub - xwiki-contrib/listener-formula-pre-cacher: Formula pre-caching listener
JIRA Project : Loading...

Stupid question: Why create a contrib repo instead of improving the formula macro directly? :slight_smile:

This extension is done as part of a client request, and unfortunately, I don’t think that we would have enough time in this mission to integrate the extension properly into the product.

Smaller tasks can be easier to integrate (eg Loading...), however, we only have a couple of hours for this, and we need a bit of flexibility in our capacity to release a new version of the extension quickly, in case we need to add new features.

Regarding the specific case of the formula macro, I believe that it could be interesting to think about taking it out of the platform repository, and porting as an extension part of xwiki-contrib, like what was done with the blog application some years ago. This way, it could be easier to ship improvements on the extension without having to impact the core.

It’s all about deciding if by default the formula macro is core or not (ie. whether it should be in XS by default or not). Note that there are other contrib extensions bundled in XS but that’s something we’d like to fix as it’s not normal that it be the case (for various reasons, including one of quality/support, you need to be voted/have a certain level of understanding the platform for pushing changes while it’s not the case for contrib).

I personally think it could be ok to decide that the formula macro is not bundled by default. We’d need to review other bundled macros too decide how we draw the line though and to have some consistency.