Module 21: Performance Optimization (SAPUI5)
Performance is a first-class requirement in enterprise SAPUI5 applications.
Slow UI directly impacts user adoption, productivity, and business trust.
This module covers proven techniques to optimize SAPUI5 applications at scale.
1. Why Performance Optimization Matters
Common Performance Symptoms
- Slow app startup
- Laggy tables
- UI freezing during operations
- High memory usage
Most performance issues come from poor binding and data handling, not the framework.
2. Lazy Loading Views
What is Lazy Loading?
Lazy loading ensures:
- Views
- Controllers
- Dependencies
are loaded only when required.
How UI5 Supports Lazy Loading
- Routing loads views on demand
- Components are loaded dynamically
- Async view loading
Always use routing-based navigation.
Async View Configuration (manifest.json)
"routing": {
"config": {
"async": true
}
}
3. Reduce Re-Rendering
What Causes Re-Rendering?
- Frequent model refresh
- Deep binding paths
- Heavy formatters
- Direct control manipulation
Best Practices to Reduce Re-Rendering
- Update specific properties, not whole models
- Use element binding
- Avoid calling rerender() manually
Example: Targeted Update
oModel.setProperty("/status", "Approved");
4. Model Size Optimization
Problem: Large Payloads
- Slower load times
- Higher memory usage
- Poor table performance
Optimization Techniques
- Use $select to limit fields
- Use $filter to reduce rows
- Use $expand sparingly
Backend Responsibility
Performance starts in CDS and OData design, not UI.
5. Avoiding Heavy Bindings
Heavy Binding Anti-Patterns
- Formatters in large tables
- Deep binding paths (/a/b/c/d)
- Two-way binding everywhere
- Binding inside loops
Preferred Alternatives
- Use element binding
- Use expression binding for simple logic
- Pre-calculate values in model
6. Table Performance
Table Performance Killers
- Loading too many rows
- Complex controls in cells
- Client-side filtering
Best Practices for Tables
- Use growing="true" for sap.m.Table
- Limit visible columns
- Use text controls in cells
- Prefer server-side paging
Example: Growing Table
<Table
growing="true"
growingThreshold="20"
items="{/SalesOrderSet}">
</Table>
7. UI5 Best Practices (Performance-Focused)
General Best Practices
- Keep controllers thin
- Use JSONModel for UI state
- Cache fragments and dialogs
- Use async APIs
- Clean up resources on exit
Memory Management
onExit: function () {
if (this._oDialog) {
this._oDialog.destroy();
}
}
8. Performance Debugging Tools
Useful Tools
| Tool | Purpose |
|---|---|
| Chrome DevTools | Network & JS profiling |
| UI5 Support Assistant | Best practice checks |
| Network tab | Payload inspection |
UI5 performance issues are usually visible in network traces.
9. Common Performance Mistakes
- Full model refreshes
- Overusing MessageBox
- Deep nested layouts
- Ignoring growing/paging
10. Interview-Grade Explanation
Q: How do you optimize performance in SAPUI5?
Answer:
I optimize UI5 performance by lazy loading views, minimizing model payload using $select and $filter, reducing re-rendering through targeted model updates, avoiding heavy bindings and formatters, and optimizing table usage with server-side paging and growing.
11. Summary
- Lazy loading improves startup
- Reduce unnecessary re-rendering
- Optimize model size
- Avoid heavy bindings
- Table design impacts performance heavily
- Performance requires UI + backend alignment
12. What’s Next?
➡️ Module 22: Error Handling & Logging in SAPUI5
Performance problems are architectural — fix the design, not the symptom.