question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What caused the performance issues for the `sap.ui.core.XMLComposite`

See original GitHub issue

Hello,

as per this answer, “major performance issues” were the reason that got the sap.ui.core.XMLComposite class deprecated. Is it possible to shed a little more light on this? What exactly causes the issues, is usage of this control somewhat still safe if some guidelines are adhered?

Thanks

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
codeworriorcommented, Nov 15, 2022

Well, it was not only about performance. But let’s start with that one:

Performance The main problem is with the ManagedObjectModel (MOM) which is used by the XMLComposite to connect its façade with the internals. The MOM introduces another layer of data binding (with two layers of events and listeners). When used in a fine-grained way (small composite controls), we observed a significant performance penalty through these additional layers. When used in a less fine-granular way, the performance of the MOM degrades, too as it installs many change listeners in larger control trees. This, btw, are not theoretical considerations. An early iteration of the sap.ui.mdc library (long before it went open source), heavily used XMLComposites and then ran into these issues. Most of the controls had to be re-implemented as “standard” composites to address the issues.

Synchronous Loading As the XMLComposite is a control and as controls in UI5 are created synchronously via constructor, the XMLComposite uses synchronous processing of the fragment to build its control tree. This does not work well with strong Content Security Policies (CSPs). Currently, library preloads address this, but we also try to stay CSP compatible in single requests scenarios (thinking into the direction of http2 / http3 and smaller, portioned bundles or for Hybrid container apps). Making the XMLComposite compliant with such scenarios either would result in async control tree creation (causing a bad flickering “Web 2.0” experience) or would require additional investment in some kind of an async construction mechanism (like we have it for views and fragments).

XMLView Caching The XMLComposite implements its dynamic aspects only after instantiating the control (as it loads the fragment only during construction to assign instance-specific IDs and as the MOM only works on controls). This prevents it from benefitting from the XMLView caching, which has to happen before controls are instantiated. As a result, the dynamic aspects have to be processed each time again, although in many cases (e.g. when based on model metadata) at least parts of it should be cacheable.

Complexity / Supportability Additionally, the XMLComposite together with the MOM introduces a complexity that is hard to handle for developers. It’s hard to understand what’s going on, it’s hard to debug.

So from our point of view, the XMLComposite has several pain points. For sure, we could invest in each of them and try to find solutions. But in sum, there have been too many topics (esp. taking our limited capacity into account). Plus, there are alternative approaches. Scenarios, that don’t require the complexity of the MOM can use fragments; the Fiori Elements stack V4 (aka sap.fe) introduced another approach called macros (or, meanwhile building blocks) that are resolved at templating time and therefore perfectly integrate with XMLView caching). We had many controversial discussions before deciding, as we’re well aware of the need for and the benefits of a declarative approach for composites. But the need for significant investments in multiple areas on the other side or the risk of getting many customer incidents if the XMLComposite is used “as is” more widely, together with the existence of established alternatives finally made us decide for the deprecation.

Last but not least, we hope to revisit the topic of declarative composites again in future, but maybe with a rather build-time centric approach.

2reactions
nnaydenowcommented, Jan 10, 2022

Hello @dfenerski, Thank you for sharing this finding. I’ve created an internal incident 2280008843. The status of the issue will be updated here in GitHub. Regards, Nayden

Read more comments on GitHub >

github_iconTop Results From Across the Web

sap.ui.core.XMLComposite - deprecated?
Hello Samuel,. we had to deprecate the XMLComposite due to major performance issues inside larger applications. Sadly there is no (planned) ...
Read more >
Performance Issues - Documentation - Demo Kit - SAPUI5 SDK
A critical factor for application performance is the loading of data from a server. ... Whenever you use methods like sap.ui.model.odata.v4.
Read more >
Performance Checklist for UI5 Apps - LinkedIn
Performance issues are often caused by an old bootstrap ... In most apps it's enough to load the libraries sap.ui.core and sap.m by...
Read more >
sapui5 - App takes more than a minute to load for the first time
Technical Optimizations. I see you're using sap.ui.comp.smarttable.SmartTable without preloading its dependencies.
Read more >
Performance: Speed Up Your App
If a web app has performance issues, finding the cause can be both a time-consuming and ... <script id="sap-ui-bootstrap" src="/resources/sap-ui-core.js" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found