OP-TED / eforms-notice-viewer

This is a sample eForms application that can visualise an eForms notice. It uses efx-toolkit-java to generate XSL templates from notice view templates written in EFX. It then uses an XSLT processor to generate an HTML visualisation of any given eForms notice.
https://docs.ted.europa.eu/eforms-common/notice-viewer/index.html
European Union Public License 1.2
10 stars 1 forks source link

increase performance #82

Closed wanao-jd closed 10 months ago

wanao-jd commented 11 months ago

To convert xml to html (with the sdk that is already download) the notice viewer take about 5 secondes. if we use the ted europa online API it is faster. 1-2 secondes how can we increase performance of conversion in local env with eforms-notice-viewer project ?

rousso commented 11 months ago

Hi @wanao-jd,

The "problem" with the performance of the Notice Viewer sample app is in the following line of code: https://github.com/OP-TED/eforms-notice-viewer/blob/7ea3c874825cc5d8d7ce6ceffc4bdbf803b021e9/src/main/resources/templates/xsl_markup/output_file.ftl#L33

In the context of the sample application this is not a mistake. It is just a shortcut we took to keep the implementation simpler. The code in that line is heavy to execute but easy to write and understand.

In the context of the production application that we use for TEDAPI however, we had to follow a different approach.

Essentially, the XSL line I shared above, loads all labels from a specific version of the SDK and for a specific language regardless of whether the labels are needed while rendering the notice. This is not a good idea in terms of performance.

TED Viewer (our notice visualisation service that you access through TED API) follows a different logic which performs much better: It loads labels on demand by calling a service. Everything is still done through XSL, but labels are resolved one at a time, only when needed, through a service.

It would be nice if we could share the code for this with everyone (by incorporating a similar implementation in the sample application), but, at the time, it is not possible to include this activity in our immediate planning. I will see what we can share, and I will get back to you. I know of another eSender that expressed interest on the same improvement and is working on implementing it in the same direction as we did for TED Viewer.

hornschorsch commented 10 months ago

Hello, it would be great if this issue could be solved!

Bye, Georg