- Qt 6.11
- Qt Qml
- Advanced QML Topics
- Qt 6.11.1 Reference Documentation

QTP0005 ◦ The QML Disk Cache

# Advanced QML Topics

This section covers advanced topics for optimizing and fine-tuning QML applications.

## Caching and Performance

### The QML Disk Cache

The QML disk cache stores compiled QML and JavaScript code on disk to improve application startup time. When a QML document is loaded for the first time, it's compiled to bytecode and cached in a platform-specific location. Subsequent loads of the same document can use the cached bytecode instead of recompiling from source, significantly reducing initialization overhead.

## JavaScript Engine Configuration

### Configuring the JavaScript Engine

The JavaScript engine can be configured with various environment variables to control compilation behavior, garbage collection settings, and runtime optimizations. These settings allow you to tune the JavaScript engine for specific use cases, such as favoring startup time over peak performance or adjusting memory usage patterns.

### Memory Management in the JavaScript Engine

The JavaScript engine uses garbage collection to automatically reclaim memory from objects that are no longer in use. Understanding how the garbage collector works, including generational collection strategies and heap organization, helps you write QML and JavaScript code that performs efficiently and avoids common memory-related performance pitfalls.

See also QML Profiler and JavaScript Host Environment.