perf (LuaJIT): stop cross-codec trace pollution in long mixed processes; bench.sh mixed
- compat math.clamp is vararg: LuaJIT never starts a root trace at a vararg function but still inlines it. The plain shim, called from interpreted code, collected aborted root traces until it was blacklisted, after which every trace through it aborted: in one process, png (or anything earlier) left jpeg / webp / tiff / ImageOps 2-10x slower. - Dct.fdctQuantize: branch-free quantiser and a divisor table (q * 8) from Jpeg.Encode; the sign branch among the column pass's live values made LuaJIT retry side traces it could not compile (register coalescing) forever. Also faster in luau -O2 (~5%) and native (~10%). Outputs unchanged. - tools/bench_mixed.luau + bash tools/bench.sh mixed: core, audio, video, image in one LuaJIT process against the per-codec benches, marking lines more than 1.3x slower mixed.
This commit is contained in:
1 parent
dde6be117c
commit
a87ad99410
12 files changed
+802
-710
No files matched your search
+13
-1
@@ -2,7 +2,9 @@
|
||||
# Timings (bash tools/bench.sh [core [filter]]): tools/bench.luau under luau --codegen -O2 and under LuaJIT (the module build,
|
||||
# build/_modules/luajit). "core" runs tools/bench_core.luau (inflate / deflate, checksums, rbxm / rbxmx, json / xml,
|
||||
# F.detect, gltf / obj, the other decompressors) under luau -O2, luau --codegen -O2 and LuaJIT; a filter keeps the lines
|
||||
# whose label contains it.
|
||||
# whose label contains it. "mixed" (LuaJIT only) runs tools/bench_image.luau and tools/bench_video.luau each on its own,
|
||||
# then tools/bench_mixed.luau: core, audio, video and image in one process, marking the lines that run more than 1.3x
|
||||
# slower there (trace pollution between codecs).
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
LUAU=${LUAU:-$(command -v luau || nix shell nixpkgs#luau -c sh -c 'command -v luau')}
|
||||
LUAJIT=${LUAJIT:-$(command -v luajit || nix shell nixpkgs#luajit -c sh -c 'command -v luajit')}
|
||||
@@ -15,5 +17,15 @@ if [ "$1" = core ]; then
|
||||
"$LUAJIT" -e "$LJPATH" build/_modules/luajit/tools/bench_core.lua "$2"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$1" = mixed ]; then
|
||||
tmp=$(mktemp -d)
|
||||
for s in image video; do
|
||||
"$LUAJIT" -e "$LJPATH" build/_modules/luajit/tools/bench_$s.lua > "$tmp/$s" || exit 1
|
||||
done
|
||||
"$LUAJIT" -e "$LJPATH" build/_modules/luajit/tools/bench_mixed.lua "$tmp/image" "$tmp/video"
|
||||
status=$?
|
||||
rm -r "$tmp"
|
||||
exit $status
|
||||
fi
|
||||
"$LUAU" --codegen -O2 tools/bench.luau
|
||||
"$LUAJIT" -e "$LJPATH" build/_modules/luajit/tools/bench.lua
|
||||
Reference in new issue
Block a user