TikTok for Developers

Developer Docs

Last updated November 28, 2026

Optimize Mini Game Performance

Find where the player waits or the game stalls, then change the work that causes it. Performance covers the first entry, revisits, gameplay, scene changes, ads, and moving between the background and foreground. Package size is only part of it.

This page gives an overview of each area. For step-by-step guidance, see the following guides:

For Unity build size and startup settings, see the Unity packaging optimization guide.

Prerequisites

  • A mini game that runs in Client preview on a phone
  • Access to your app on the Developer Portal. For released games, analytics are available in Mini Games Analytics.

Find where performance affects the player

Performance affects the player from opening the game, through gameplay and optional ad or purchase experiences, to returning on later visits. Start with the problem the player sees, then measure that stage.

Diagram of a mini game’s player journey: start, gameplay, ads, and revisiting a saved level

Stage

What the player experiences

What to measure

Where to start

Start

The loading screen stays up too long, or the game doesn't respond on first entry. Resource downloads or required API requests might be slow.

Analytics: Launch success rate, average launch speed, and average first-time launch speed.
On a phone: The time from opening the game to responsive gameplay. Check resource requests, initialization, and required API calls.

Shorten startup waits

Play

Animation stutters, input responds slowly, or a new scene takes too long to open. The game might also slow down during a long session or after the player returns to it.

Analytics: Runtime FPS and stutter rate.
On a phone: Reproduce the scene, then check frame time, scripts, rendering, resource loading, and memory pressure.

Improve runtime performance, Shorten resource and scene loading, Control memory and background work

Monetize

After choosing to watch an ad, the player waits too long for it to open, or it doesn't appear. In games with purchases, the purchase flow might be slow or fail.

Ad analytics: Ad load failure rate and ad display failure rate.
On a phone: The wait from the player's choice to the ad appearing. Check ad requests, preload timing, and failures. For purchases, observe the purchase flow and investigate delays or errors.

Reduce ad display waits, In-App Purchases

Revisit

Returning on a later visit feels as slow as the first launch, reopening a saved later level loads its assets again, or an update leaves outdated content.

Analytics: Compare average launch speed with average first-time launch speed.
On a phone: Measure a cold revisit after restarting the TikTok app separately from a clean first launch. Check remote cache reuse, resuming a saved level, and refreshes after updates.

Speed up revisits, Manage cached assets and updates

Measurements on a device are separate from analytics. When you compare runs, use the same device, network, and cache conditions.

Shorten startup waits

Separate the startup wait into downloads, engine setup, first-scene loading, and required API requests. For fixes and for measuring first paint, time to interactive, download, and cache state, see Optimize Startup.

Define where your timing starts and ends. Game logs miss the wait before your code runs, and the first screen isn't the same as responsive gameplay. Confirm the intervals your timing covers before you compare it with Developer Portal metrics.

Diagram showing first-level game assets loaded upfront while later levels and character variants are deferred
  • Downloads: Compress first-scene textures and audio, remove unused assets, and defer later levels. In Unity, use LZ4 bundles, turn on ClearStreamingAssets, and compare build reports. For details, see Unity Packaging Optimization.
  • Initialization: Defer startup scripts and bulk object creation that aren't essential. In Unity, set OptimizeSize, turn off WebAssembly 2023 and Bulk Memory, and use Wasm code splitting when Wasm delays startup.
  • Business requests: Run independent requests in parallel, and keep the identity, save, and permission handling they require. Show UI the player can recover from when a request fails.

Collect startup subpackages

For a non-Unity game that loads subpackages at startup, DevTool can record which subpackages the startup path uses, so the TikTok app can download them in advance.

Subpackage collection requires @ttmg/cli 0.4.4 or later, TikTok 45.9 or later on Android or 46.0 or later on iOS, and a TikTok account outside the US.

  1. Declare subpackages in game.json.
  2. Call TTMinis.game.reportScene({ sceneId: 9999 }) once, when real gameplay begins. For details, see Report time to interactive.
  3. In DevTool, go to Performance > Subpackage Collection and select the entry.
  4. Connect a phone and play until the first interactive gameplay.
  5. Review the collected list and finish the collection.
  6. Repeat for each independent entry.

Collection writes the candidates to parallelPreloadSubpackages for that entry. The TikTok app decides whether to download them in advance based on the network and its download policy. Keep your game's existing loading and failure handling, and compare runs on a device.

After you make changes, check that the first gameplay scene responds. Check visuals, audio, login and saves, and the first and later levels again. The loading UI should reflect actual progress. Hiding it earlier isn't an improvement.

Improve runtime performance

Runtime performance is how the game behaves after play begins: whether animation and input stay smooth, how long later scenes take to open, and whether the game stays responsive during long sessions and after it returns to the foreground. For detailed steps, see Optimize Runtime Performance.

Workflow for improving game performance: reproduce the issue, locate the cost, apply a change, and retest; investigate again if it persists

Measure gameplay performance

  1. Check trends for your released game. On the Developer Portal, go to Analytics > Performance and review runtime FPS, stutter rate, and report count. Compare the same date range and the same device or region filters. For details, see Mini Games Analytics.
  2. Reproduce the problem on a phone. In the TikTok app preview, open … > Developer options. Turn on Show DevInfo Panel and Show vConsole, then replay the scene and check the runtime FPS and logs.
  3. Check frame timing. If your engine's profiler supports the target build, check frame time around the visible pause. The Unity Profiler is one option. A high average FPS can still hide short stalls.

Aggregate data can't identify a single stall. A memory warning indicates memory pressure, not exact memory use or a crash. For scene transition waits, see Shorten resource and scene loading. For memory or visibility issues, see Control memory and background work.

Reduce gameplay stalls

  • Scripts and UI: Update score and health displays only when their values change. Move unrelated calculations and object creation away from input handling, and keep input, collision, and core gameplay responsive.
  • Object creation and disposal: Track the peak number of projectiles or effects in use at the same time. Reuse them through a pool with a fixed size, reset their state, and release unused entries. For Unity, see the garbage collection best practices.
  • Rendering: Check draw calls, materials, masks, particles, and shadows. Turn off one effect and replay the scene. A texture atlas alone doesn't guarantee batching. For details, see Unity graphics performance or Cocos Creator 3.8 UI batching.
  • Resource processing: Move downloads, parsing, and bulk object creation that aren't urgent away from input handling. Have required assets ready before use, and provide a retry if loading fails.

After you change quality settings or object counts, test the original busy scene and the controls again. A higher target frame rate setting doesn't prove that play is smoother.

Shorten resource and scene loading

Loading includes downloading, parsing, creating objects, and entering the scene. Subpackages and remote assets still need a loading schedule and a retry path. For package layout and loading, see Manage Packages and Assets.

Mini-game flow from downloaded files through asset preparation and scene entry to responsive input; downloads alone aren’t playable
  • Prepare the likely next content: Download in advance only when current play is stable and the next scene is predictable, and leave bandwidth and memory for active play. Cancel loads the player abandons. For Cocos, see Build Mini Games With Cocos.
  • Unity remote assets: Keep the bootstrap and retry UI local, and move later scenes to remote LZ4 groups with ClearStreamingAssets turned on. Deploy them over HTTPS, register the domain, and test the retry on a phone. For details, see the Technical Overview.
  • Separate downloading from readiness: preDownloadSubpackage() downloads a subpackage. loadSubpackage() also runs its entry. Engine processing still follows. In Cocos, preloading doesn't complete parsing and initialization.
  • Keep a usable screen: Show a lightweight transition, wait for required assets, and offer a retry or a way back if loading fails.
  • Configure cache reuse and versioning: Keep remote files within the size limits, exclude manifests that change, keep shared content, and version bundles by hash. Test repeat launches and updates. For details, see Manage cached assets and updates.

Downloaded files aren't a playable scene. Check readiness, scene entry, and the first input, including memory use while the old and new scenes overlap.

Reduce ad display waits

Measure the time from the ad trigger to the ad appearing. Separate slow loading, failures, and cases where no ad is available. Preloading moves the ad request earlier. How much it helps depends on readiness, the network, and the ad's state. For API details, compatibility, and error codes, see Preload Ads.

Ad flow: prepare during play, then call show() when the player chooses to watch an ad
  • Choose when to prepare: Preload on a visible reward page with a usable ad entry, or shortly before a predictable revive or reward point. Load essential game assets first. Don't request ads too early, too often, or in the background without a clear placement.
  • Check preload support: TikTok 46.1.0 and later supports preloading on iOS and Android. Check rewarded and interstitial ads separately. In JavaScript, pass createRewardedVideoAd.return.load or createInterstitialAd.return.load to TTMinis.game.canIUse(). In Unity, check CanIUse.TTRewardedVideoAd.Load or CanIUse.TTInterstitialAd.Load.
  • Preload when supported: Register load, error, and close listeners, then call load() or Load() if the instance isn't already loading or ready. On clients without preload support, skip preloading and keep your existing display flow.
  • Show on the player's action: Call show() or Show() right away, without waiting for onLoad or IsLoaded(). A preload that's still running is queued, and a failed preload falls back to a live request. Handle display errors.
  • Handle completion and the next ad: Grant a reward only after the close callback confirms the player completed the ad. Remove the listeners and discard the used instance, and destroy it in Unity, before you create and preload the next ad.

A successful preload isn't a display or a completed ad, and it can't authorize a reward. Compare the waits and successful displays. Test for regressions in startup and gameplay, on unsupported clients, after failures, and with repeated taps.

Control memory and background work

Enter and exit scenes repeatedly, and check that resources and tasks are released. Download size, runtime memory, active objects, and running tasks are different measurements. Compressed size alone can't explain memory behavior.

  • Clean up on exit: Remove scene timers, listeners, temporary objects, and assets only that scene uses. Keep shared content that's still referenced. Check that asynchronous results still belong to the current scene or request. For Cocos, see asset release and reference counting.
  • Limit resident content: Size caches, pools, and prepared levels to what the game needs. Free unused content without deleting player saves.
  • Resume without duplicates: When the game is hidden, save required state and pause timers, audio, and polling the game doesn't need. When it returns, check scenes, assets, and pending operations, and avoid duplicate listeners or loops. Use the visibility events to handle these transitions.
  • Handle memory pressure: Release unused resources and reduce preparation work as needed. A warning isn't a memory reading and doesn't mean the game will be closed. Keep your normal ownership and cleanup. For details, see Memory.

Test repeated transitions, revisits, opening features, and visibility changes again. Check shared visuals, audio, saves, and ad state.

Speed up revisits

Optimizing the first launch reduces what a new player downloads once. Optimizing revisits keeps returning players from waiting for the same work again.

In Mini Games Analytics, compare the average launch speed with the average first-time launch speed. On a phone, time first launches and cold revisits separately. If the waits are similar, returning players are repeating work.

Diagram comparing first-launch and cold-revisit speeds, with fixes for repeat downloads, saved levels, updates, and background resumes

Revisit situation

Why returning players wait

What to optimize

Cold revisit: the player reopens the game from the feed, a shortcut, the sidebar, or history.

Remote bundles download again, because of a missing cache host, files over 10 MB, or JavaScript downloads kept only in temporary storage. Or startup repeats sync and configuration requests one after another.

Store remote assets locally: in Unity, use Cache domain List and keep bundles under 10 MB. In custom JavaScript, use saveFile. Avoid bursts of many small files, and defer or parallelize sync that isn't essential.

Resuming a later level: a returning player's save opens after Level 1.

Startup tuning covered only Level 1, so resuming Level 20 waits for uncached remote art, large save parsing, or synchronous scene setup.

Load only the saved level and shared assets on resume, reuse level bundles cached earlier, and show a usable transition with a retry if a remote bundle must be downloaded.

Returning after an update: the player opens a new build or asset release.

Cached manifests that change keep outdated assets in place, or clearing everything forces players to download unchanged content again, or risks losing saves.

Exclude manifests that change (.hash and .json) from the cache, version bundles that don't change by content hash so only changed files download, and never use clearStorage to clear asset caches.

Returning from the background: the player switches back from another screen or app.

Scene reloads, duplicate timers, or listeners registered again cause stalls right after the game returns to the foreground.

Pause work that isn't essential while hidden, and resume the existing state without rebuilding scenes or duplicating loops. For details, see Control memory and background work.

Measure revisits against their own baseline. On one phone, compare a cold first launch, a cold revisit, and a launch after an update. For details, see Optimize Startup and Manage cached assets and updates.

Next steps

TikTok for Developers