Frontory

Open code, practice, and notes →

Download source with English comments · for reading

PixiJS · 25 Forming a Batching Hypothesis

Series contents · Technology map

Stage: Resource Ownership, Large-Scale Rendering, and Measurement · Editable example · Storage ID: pixijs-step-25

Goals and learning outcomes

Prerequisites

Prerequisite concepts: Visibility and Computation, Visibility Bounds. Prepare the output files and observation records from Unit 24.

Key concepts and explanations

State Changes

Textures, blending, and shape types affect rendering batches. Alternating between two textures does not necessarily double the calls.

Preserving Behavior

Sorting optimizations can change translucent overlaps. Reorder only objects whose visual order can be preserved.

Practice setup

First check the execution scope guidance on the example screen. The following describes preparation for extending the assignment in a separate project. Implement the work yourself in an HTML and ES module project served by a separate local HTTP development server. Pin and record the installed pixi.js 8.x version.

The linked example is a starting point. It does not implement every task below. Complete work beyond its supported scope in a separate project.

Practice tasks

  1. Prepare day-25.js and index.html in the external practice project. Arrange non-overlapping Sprites and Graphics in alternating order and grouped by type.
  2. Keep counts and positions unchanged, recording profiles and frame intervals; report call counts only if a tool can verify them directly.
  3. Save the output with the input condition Alternate Sprites and Graphics, then run again with Group by type. Expected: State transition costs may decrease, but actual measurement is required. Compare this with the actual screen and logs, and record the actual result and causes of any differences in day-25-notes.md.

Variables to observe

VariableBaselineChangeExpected change / hypothesis
Drawing orderAlternate Sprites and GraphicsGroup by typeState transition costs may decrease, but actual measurement is required

Predictions in this table are not measured results. Change one condition at a time and record why the actual result differs.

Completion criteria

Self-check

  1. Can multiple textures be included in one batch?
  2. What breaks when sorting changes translucent overlaps?

Official references

Linked example and execution scope

Example source · Runtime environments and limits

This is an editable browser experiment. Measurements vary with the current device and browser.

Source code and records are not overwritten automatically. Resetting an existing example also preserves your notes.

Next learning

Previous: Offscreen Handling and Fewer Updates · Next: Profiling and Quality Budgets

Open code, practice, and notes →