Profile before optimizing. PixiJS handles a lot of content well out of the box; browser DevTools Performance + GPU profiling should be your first move. Once you've found the bottleneck, apply the targeted pattern below (destroy, pool, batch, cache, or cull).
Quick Start
container
.
cacheAsTexture
(
true
)
;
container
.
updateCacheTexture
(
)
;
container
.
cacheAsTexture
(
false
)
;
container
.
destroy
(
{
children
:
true
}
)
;
import
{
CullerPlugin
,
extensions
}
from
"pixi.js"
;
extensions
.
add
(
CullerPlugin
)
;
offscreenContainer
.
cullable
=
true
;
offscreenContainer
.
cullArea
=
new
Rectangle
(
0
,
0
,
256
,
256
)
;
// Tune GC via init options (ms). The textureGC.* properties are
// deprecated since 8.15.0 — use these on the Application init instead.
await
app
.
init
(
{
gcMaxUnusedTime
:
60_000
,
gcFrequency
:
30_000
}
)
;
pixijs-performance
安装
npx skills add https://github.com/pixijs/pixijs-skills --skill pixijs-performance