bench: Godot tscn decode / encode, LDtk, ASE lines

This commit is contained in:
4DBug committed 2026-11-01 19:35:11 -06:00
1 parent 8d305bb942
commit 74df2ed607
1 file changed
+36
+36
View File
@@ -1923,3 +1923,39 @@ do
assert(BspFmt.decode(Bytes.reader(bsp)))
end)
end
-- ws-engines: text scene / level formats, MB/s of file text: Godot .tscn (Godot's own main.tscn with a 2210-vertex
-- sphere and base64 surfaces; codecs/text/GodotVariant + ArrayMesh surfaces), an LDtk sample project, 3ds Max ASE
-- (assimp's MotionCaptureROM.ase); fixtures tools/fixtures/godot.py, ldtk.py, ase.py
do
local Godot = require("@rosetta/model/godot")
local Ldtk = require("@rosetta/vector/ldtk")
local Ase = require("@rosetta/model/ase")
local Bytes = require("@rosetta/core/Bytes")
local GF = require("@tests/gen/godot")
local LF = require("@tests/gen/ldtk")
local AF = require("@tests/gen/ase_cases")
local main = buffer.fromstring(GF.cases[2].data)
local files = GF.cases[2].files
bench("godot tscn decode", 5, buffer.len(main), function()
assert(Godot.decode(Bytes.reader(main), { resolve = function(p: string): buffer?
return if files[p] then buffer.fromstring(files[p]) else nil
end }))
end)
local scene = assert(Godot.decode(Bytes.reader(main)))
bench("godot tscn encode", 5, buffer.len(main), function()
assert(Godot.encode(scene))
end)
local ld = buffer.fromstring(LF.cases[2].data)
bench("ldtk decode (" .. LF.cases[2].name .. ")", 3, buffer.len(ld), function()
assert(Ldtk.decode(Bytes.reader(ld)))
end)
for _, c in AF do
if string.find(c.name, "MotionCaptureROM", 1, true) then
local b = buffer.fromstring(c.data)
bench("ase decode (MotionCaptureROM)", 3, buffer.len(b), function()
assert(Ase.decode(Bytes.reader(b)))
end)
end
end
end