Skip to main content


GPU programming is all about performance, so having tools to systematically measure the performance impact of code changes is critical. offers several built-in facilities. Stats is a companion framework focused on instrumentation and logging of JavaScript applications. It provides a Stats class which can be thought of as a "bag" of different stats (or performance measurements), and itself automatically populates Stats objects that can be inspected by the application.

import {luma} from '';


Memory Profiling automatically tracks GPU memory usage.

Note that JavaScript is a garbage collected language and while memory allocations can always be tracked, it is only possible for to track GPU memory deallocations if they are performed through the API (by calling the .destroy() methods on Buffer and Texture objects).

Apart from GPU memory tracking for also maintain counts of the various other API objects. Such object generally do not consume a lot of memory, however tracking allocations can help spot resource leaks or unnecessary work being done.

Performance Profiling

device.createQuerySet() can be used to create GPU queries that

  • Occlusion Queries always supported.
  • Timestamp Queries are supported if the timestamp-query feature is available, check with device.features.has('timestamp-query').

QuerySet instances can be supplied when creating RenderPass and ComputePass instances.

Results are available through commandEncoder.resolveQuerySet()