Perf: cache text sizes per baked font, AddRect fast path as 4 rects; run.py --profile + prof.py

This commit is contained in:
4DBug
2026-10-08 10:03:18 -05:00
parent e12368ee21
commit 7a20710b65
5 changed files with 93 additions and 2 deletions
+2 -1
View File
@@ -33,7 +33,7 @@ def build_run(args, flags):
def run(args, extra=""):
flags = "ARG_FRAMES=%d; ARG_BIG=%s; ARG_OPEN=%s; ARG_QUIET=%s; %s" % (args.frames, str(args.big).lower(), str(args.open).lower(), str(args.quiet).lower(), extra)
try:
p = subprocess.run([LUAU, "-O2", "--codegen", build_run(args, flags)], capture_output=True, text=True, timeout=args.timeout)
p = subprocess.run([LUAU, "-O2"] + (["--profile=2000"] if args.profile else ["--codegen"]) + [build_run(args, flags)], capture_output=True, text=True, timeout=args.timeout)
except subprocess.TimeoutExpired as e:
return 124, "TIMEOUT (infinite loop?)\n" + remap((e.stdout or b"").decode(errors="replace"))
return p.returncode, remap(p.stdout + p.stderr)
@@ -58,6 +58,7 @@ def main():
ap.add_argument("--frames", type=int, default=400)
ap.add_argument("--main", default=os.path.join(ROOT, "main.client.luau"))
ap.add_argument("--big", action="store_true", help="demo window forced to 900x1000")
ap.add_argument("--profile", action="store_true", help="sampling profile (no codegen) -> profile.out; see tools/test/prof.py")
ap.add_argument("--open", action="store_true", help="force all CollapsingHeader/TreeNode open")
ap.add_argument("--timeout", type=int, default=120)
ap.add_argument("--quiet", action="store_true", help="no random input (scripted tests drive io themselves)")