360 Secure SkillHub
360 安全技能中心

roblox-performance

面向 Roblox 游戏的性能剖析与优化参考:介绍 MicroProfiler、开发者控制台、脚本剖析器等工具与标签用法,给出服务器心跳、帧率、内存等起始指标,并涵盖并行 Luau、对象池、StreamingEnabled 与移动端优化要点,强调按测量结果优化热路径。

TabooHarmony
热度 0.00
最近更新 2026-10-18 22:40:35
分类:开发依赖:纯提示词应用场景:调试排错 / 代码审查

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add tabooharmony/roblox-brain/roblox-performance
Metadata
name
roblox-performance
description
Use when profiling or fixing Roblox performance: low FPS, lag, memory, network load, slow phones, hot paths.
when_to_use
Also when the game stutters, phones overheat or crash, server heartbeat drops, before adding many parts/effects/UI, and when auditing performance before release.
last_reviewed
"2026-10-02T00:00:00.000Z"
sources
["https://create.roblox.com/docs/en-us/performance-optimization/microprofiler","https://create.roblox.com/docs/en-us/reference/engine/libraries/debug","https://devforum.roblox.com/t/huge-memory-leak-prevention-for-everyone-or-most-people-atleast/3099605","https://devforum.roblox.com/t/full-release-of-parallel-luau-v1/1836187","https://luau.org/performance","https://create.roblox.com/docs/reference/engine/classes/Actor","https://create.roblox.com/docs/reference/engine/datatypes/SharedTable","https://create.roblox.com/docs/scripting/multithreading"]

Roblox Performance

When to Load

Use for profiling and performance budgets. Pooling and lifecycle patterns: roblox-luau-patterns.

Quick Reference

Profiling Tools

  • MicroProfiler (Ctrl+F6): Frame breakdown of scripts, physics, rendering.
  • Developer Console (F9): Memory, network, rendering, and server stats.
  • Script Profiler (Ctrl+Alt+F5): Per-script CPU and heap.
  • Labels: debug.profilebegin/debug.profileend mark regions; debug.setmemorycategory labels memory. Gate instrumentation behind a flag.

Performance Targets

Metric Starting target Investigate at
Server heartbeat < 16ms > 33ms
Client FPS (desktop) 60 < 30
Client FPS (mobile) 45 < 30
Memory device-specific sustained growth

Optimize measured hot paths, not folklore. Throttle from measurements; re-profile after shipping.

Parallel Luau

  • Use Actors only after profiling identifies isolatable CPU work.
  • Workers compute; synchronize before restricted DataModel writes.
  • Do not rely on shared module state across Actors. SendMessage copies data; SharedTable supports shared state and atomic updates.

Hot-loop cost model

  • Luau optimizes global imports; avoid folklore function hoisting/unrolling. Environment impurity can disable optimizations. Profile allocations as well as CPU; GC cost may occur later.

Object Pooling

Pre-clone and reuse. Canonical pool code (token-lease ownership): roblox-luau-patterns.

StreamingEnabled Essentials

  • On by default. Container-scoped: only Workspace descendants stream. ModelStreamingBehavior = Improved streams non-BasePart descendants with their parent Model; Legacy streams only BaseParts.
  • Streamed-out = parented to nil, not destroyed. Luau refs persist if it streams back.
  • Config (Studio): target defaults 1024, min 64; set StreamingIntegrityMode; tune from data.
  • Gotcha: FindFirstChild("DistantPart") returns nil if streamed out. Use WaitForChild with timeout.

Mobile

  • Profile geometry, textures, particles, UI, shadows on low-end devices.

Full reference with code examples and API tables: references/full.md