Allow 0-term cached queries

This commit is contained in:
Ukendio 2025-09-16 14:46:06 +02:00
parent 690e9ec4d7
commit 38d631453b
6 changed files with 1544 additions and 0 deletions

201
benches/ecsgame.luau Executable file
View file

@ -0,0 +1,201 @@
local jecs = require("@jecs")
local world = jecs.world()
local Physics = world:entity()
local DamagableByPlayer = world:entity()
local Mob = world:entity()
local Player = world:entity()
local Goblin = world:entity()
local Position = world:component() :: jecs.Id<vector>
local Velocity = world:component() :: jecs.Id<vector>
local Acceleration = world:component() :: jecs.Id<vector>
local Health = world:component() :: jecs.Id<number>
local MaxHealth = world:component() :: jecs.Id<number>
local TouchHurts = world:entity()
local function setup_player(entity: jecs.Entity)
jecs.bulk_insert(world, entity,
{
MaxHealth,
Health,
Position,
Acceleration,
Velocity,
Player,
Mob,
DamagableByPlayer,
Physics,
},
{
100,
100,
vector.zero,
vector.zero,
vector.zero,
}
)
end
local function setup_goblin(entity: jecs.Entity)
jecs.bulk_insert(world, entity,
{
MaxHealth,
Health,
Position,
Acceleration,
Velocity,
Mob,
Goblin,
DamagableByPlayer,
Physics
},
{
200,
200,
vector.zero,
vector.zero,
vector.zero,
}
)
end
local function setup_wood_spikes(entity: jecs.Entity)
jecs.bulk_insert(world, entity,
{
Position,
TouchHurts,
},
{
vector.normalize(vector.create(math.random(), math.random(), math.random()))
}
)
end
type EntityKind = "player" | "goblin" | "ogre" | "big_boss_goblin" | "wood_spikes"
local function exhaustive(x: never?)
error(x)
end
local function entity_create(kind: EntityKind)
local new_entity = world:entity()
if kind == "player" then
setup_player(new_entity)
elseif kind == "big_boss_goblin" then
setup_goblin(new_entity)
elseif kind == "goblin" then
setup_goblin(new_entity)
elseif kind == "wood_spikes" then
setup_wood_spikes(new_entity)
elseif kind == "ogre" then
setup_goblin(new_entity)
else
exhaustive(kind)
end
end
for i = 1, 10 do
entity_create("player")
end
for i = 1, 100 do
entity_create("goblin")
end
for i = 1, 1000 do
entity_create("wood_spikes")
end
local it = 0
local has_physics = world:query(Position, Velocity, Acceleration):cached()
local touch_hurts_against_mobs = world:query(Position):with(TouchHurts):cached()
local damageable_mobs = world:query(Position, Health):with(DamagableByPlayer):cached()
local players = world:query(Position):with(Player):cached()
local dying_mobs = world:query(Health):cached()
local function physics(dt: number)
for entity, pos, vel, acc in has_physics do
vel += acc * dt
pos += vel * dt
acc = vector.zero
world:set(entity, Velocity, vel)
world:set(entity, Position, vel)
world:set(entity, Acceleration, vel)
it+=1
end
end
local function touch_hurts_mobs()
for _, arch2 in damageable_mobs:archetypes() do
local against_positions = arch2.columns_map[Position]
local against_health = arch2.columns_map[Health]
for row2, health in against_health do
it += 1
local against_pos = against_positions[row2]
for _, arch1 in touch_hurts_against_mobs:archetypes() do
local entity_positions = arch1.columns_map[Position]
for row, entity_pos in entity_positions do
it += 1
if vector.magnitude(against_pos - entity_pos) < 5 then
continue
end
health -= 1
end
end
against_health[row2] = health
end
end
end
local function players_damage_mobs()
for _, arch2 in damageable_mobs:archetypes() do
local against_health = arch2.columns_map[Health]
for row2, health in against_health do
it += 1
for _, arch1 in players:archetypes() do
local entity_positions = arch1.columns_map[Position]
for row, entity_pos in entity_positions do
it += 1
health -= 1
end
end
against_health[row2] = health
end
end
end
local function mobs_die()
for entity, health in dying_mobs do
it += 1
if health <= 0 then
world:delete(entity)
end
end
end
local function update(dt: number, tick: number)
it = 0
physics(dt)
touch_hurts_mobs(dt)
players_damage_mobs(dt)
mobs_die(dt)
if (tick % 10)==0 then
entity_create("goblin")
entity_create("player")
end
end
-- 0.062 seconds for 1000 frames.
for i = 1, 1000 do
update(1/60, i)
end

213
benches/smallgame.luau Executable file
View file

@ -0,0 +1,213 @@
local gamestate = {
entities = {} :: { Entity },
entity_top_count = 0,
entity_id_gen = 0
}
for i = 1, 2048 do
gamestate.entities[i] = {} :: Entity
end
type EntityKind = "player" | "goblin" | "ogre" | "big_boss_goblin" | "wood_spikes"
type EntityHandle = {
index: number,
id: number
}
type Entity = {
allocated: boolean,
handle: EntityHandle,
kind: EntityKind,
has_physics: boolean,
damagable_by_player: boolean,
is_mob: boolean,
blocks_mobs: boolean,
position: vector,
velocity: vector,
acceleration: vector,
hitbox: vector,
hit_cooldown_end_time: number,
health: number,
next_attack_time: number,
sprite_id: number,
current_animation_frame: number,
update: (Entity) -> (),
draw: (Entity) -> (),
max_health: number,
}
local function exhaustive(x: never?)
error(x)
end
local function entity_delete(entity: Entity)
table.clear(entity::any)
end
local it = 0
local it_qualified = 0
local function setup_player(entity: Entity)
entity.kind = "player"
entity.is_mob = true
entity.damagable_by_player = true
entity.max_health = 100
entity.health = 100
entity.has_physics = true
entity.acceleration = vector.zero
entity.velocity = vector.zero
entity.position = vector.zero
entity.update = function()
entity.health = entity.max_health
entity.acceleration += vector.create(
math.random(1, 5),
math.random(1, 5),
math.random(1, 5)
)
if entity.health <= 0 then
entity_delete(entity)
end
for _, against in gamestate.entities do
it += 1
if not against.allocated then
continue
end
if not against.damagable_by_player then
continue
end
it_qualified += 1
against.health -= 1
end
end
end
local function setup_goblin(entity: Entity)
entity.kind = "goblin"
entity.is_mob = true
entity.damagable_by_player = true
entity.max_health = 200
entity.health = 200
entity.has_physics = true
entity.acceleration = vector.zero
entity.velocity = vector.zero
entity.position = vector.zero
entity.update = function()
entity.acceleration += vector.normalize(vector.create(math.random(), math.random(), math.random()))
if entity.health <= 0 then
entity_delete(entity)
end
end
end
local function setup_wood_spikes(entity: Entity)
entity.kind = "wood_spikes"
entity.is_mob = false
entity.damagable_by_player = false
entity.position = vector.create(
math.random(1, 5),
math.random(1, 5),
math.random(1, 5)
)
entity.update = function()
for _, against in gamestate.entities do
it += 1
if not against.allocated then
continue
end
if against.is_mob == false then
continue
end
if vector.magnitude(against.position - entity.position) < 5 then
continue
end
it_qualified += 1
against.health -= 1
end
end
end
local function entity_create(kind: EntityKind): Entity
local new_entity: Entity = nil::any
local new_index = 0
for index, entity in gamestate.entities do
if entity.allocated then
continue
end
new_entity = entity
new_index = index
break
end
assert(new_index ~= 0)
gamestate.entity_top_count += 1
new_entity.handle = {} :: EntityHandle
new_entity.allocated = true
gamestate.entity_id_gen += 1
new_entity.handle.id = gamestate.entity_id_gen
new_entity.handle.index = new_index
gamestate.entities[new_index] = new_entity
if kind == "player" then
setup_player(new_entity)
elseif kind == "big_boss_goblin" then
setup_goblin(new_entity)
elseif kind == "goblin" then
setup_goblin(new_entity)
elseif kind == "wood_spikes" then
setup_wood_spikes(new_entity)
elseif kind == "ogre" then
setup_goblin(new_entity)
else
exhaustive(kind)
end
return new_entity
end
for i = 1, 10 do
entity_create("player")
end
for i = 1, 100 do
entity_create("goblin")
end
for i = 1, 1000 do
entity_create("wood_spikes")
end
local function update(dt: number, tick: number)
it = 0
it_qualified = 0
for _, entity in gamestate.entities do
it += 1
if not entity.allocated then
continue
end
it_qualified += 1
entity.update(entity)
if entity.has_physics then
entity.velocity += entity.acceleration * dt
entity.position += entity.velocity * dt
entity.acceleration = vector.zero
end
end
if (tick % 10)==0 then
entity_create("goblin")
entity_create("player")
end
end
-- 14.839 seconds for 1000 frames
for i = 1, 1000 do
update(1/60, i)
end

View file

@ -0,0 +1,46 @@
local jecs = require("@jecs")
local world = jecs.world()
local IsA = world:entity()
world:set(IsA, jecs.OnAdd, function(component, id)
local second = jecs.pair_second(world, id)
assert(second ~= component, "circular")
local is_tag = jecs.is_tag(world, second)
world:added(component, function(entity, _, value)
if is_tag then
world:add(entity, second)
else
world:set(entity, second, value)
end
end)
world:removed(component, function(entity)
world:remove(entity, second)
end)
if not is_tag then
world:changed(component, function(entity, _, value)
world:set(entity, second, value)
end)
end
local r = jecs.record(world, second) :: jecs.Record
local archetype = r.archetype
if not archetype then
return
end
local types = archetype.types
for _, id in types do
if jecs.is_tag(world, id) then
world:add(component, id)
else
local metadata = world:get(second, id)
if not world:has(component, id) then
world:set(component, id, metadata)
end
end
end
-- jecs.bulk_insert(world, component, ids, values)
end)

654
perf.svg Executable file
View file

@ -0,0 +1,654 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" width="1200" height="192" onload="init(evt)" viewBox="0 0 1200 192" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Flame graph stack visualization. See https://github.com/brendangregg/FlameGraph for latest version, and http://www.brendangregg.com/flamegraphs.html for examples. -->
<defs>
<linearGradient id="background" y1="0" y2="1" x1="0" x2="0" >
<stop stop-color="#eeeeee" offset="5%" />
<stop stop-color="#eeeeb0" offset="95%" />
</linearGradient>
</defs>
<style type="text/css">
text { font-family:Verdana; font-size:12px; fill:rgb(0,0,0); }
#search, #ignorecase { opacity:0.1; cursor:pointer; }
#search:hover, #search.show, #ignorecase:hover, #ignorecase.show { opacity:1; }
#subtitle { text-anchor:middle; font-color:rgb(160,160,160); }
#title { text-anchor:middle; font-size:17px}
#unzoom { cursor:pointer; }
#frames > *:hover { stroke:black; stroke-width:0.5; cursor:pointer; }
.hide { display:none; }
.parent { opacity:0.5; }
</style>
<script type="text/ecmascript">
<![CDATA[
"use strict";
var details, searchbtn, unzoombtn, matchedtxt, svg, searching, currentSearchTerm, ignorecase, ignorecaseBtn;
function init(evt) {
details = document.getElementById("details").firstChild;
searchbtn = document.getElementById("search");
ignorecaseBtn = document.getElementById("ignorecase");
unzoombtn = document.getElementById("unzoom");
matchedtxt = document.getElementById("matched");
svg = document.getElementsByTagName("svg")[0];
searching = 0;
currentSearchTerm = null;
}
window.addEventListener("click", function(e) {
var target = find_group(e.target);
if (target) {
if (target.nodeName == "a") {
if (e.ctrlKey === false) return;
e.preventDefault();
}
if (target.classList.contains("parent")) unzoom();
zoom(target);
}
else if (e.target.id == "unzoom") unzoom();
else if (e.target.id == "search") search_prompt();
else if (e.target.id == "ignorecase") toggle_ignorecase();
}, false)
// mouse-over for info
// show
window.addEventListener("mouseover", function(e) {
var target = find_group(e.target);
if (target) details.nodeValue = g_to_text(target);
}, false)
// clear
window.addEventListener("mouseout", function(e) {
var target = find_group(e.target);
if (target) details.nodeValue = ' ';
}, false)
// ctrl-F for search
window.addEventListener("keydown",function (e) {
if (e.keyCode === 114 || (e.ctrlKey && e.keyCode === 70)) {
e.preventDefault();
search_prompt();
}
}, false)
// ctrl-I to toggle case-sensitive search
window.addEventListener("keydown",function (e) {
if (e.ctrlKey && e.keyCode === 73) {
e.preventDefault();
toggle_ignorecase();
}
}, false)
// functions
function find_child(node, selector) {
var children = node.querySelectorAll(selector);
if (children.length) return children[0];
return;
}
function find_group(node) {
var parent = node.parentElement;
if (!parent) return;
if (parent.id == "frames") return node;
return find_group(parent);
}
function orig_save(e, attr, val) {
if (e.attributes["_orig_" + attr] != undefined) return;
if (e.attributes[attr] == undefined) return;
if (val == undefined) val = e.attributes[attr].value;
e.setAttribute("_orig_" + attr, val);
}
function orig_load(e, attr) {
if (e.attributes["_orig_"+attr] == undefined) return;
e.attributes[attr].value = e.attributes["_orig_" + attr].value;
e.removeAttribute("_orig_"+attr);
}
function g_to_text(e) {
var text = find_child(e, "details").firstChild.nodeValue;
return (text)
}
function g_to_func(e) {
var child = find_child(e, "rawtext");
return child ? child.textContent : null;
}
function update_text(e) {
var r = find_child(e, "rect");
var t = find_child(e, "text");
var w = parseFloat(r.attributes.width.value) -3;
var txt = find_child(e, "rawtext").textContent.replace(/\([^(]*\)$/,"");
t.attributes.x.value = parseFloat(r.attributes.x.value) + 3;
// Smaller than this size won't fit anything
if (w < 2 * 12 * 0.59) {
t.textContent = "";
return;
}
t.textContent = txt;
// Fit in full text width
if (/^ *$/.test(txt) || t.getSubStringLength(0, txt.length) < w)
return;
for (var x = txt.length - 2; x > 0; x--) {
if (t.getSubStringLength(0, x + 2) <= w) {
t.textContent = txt.substring(0, x) + "..";
return;
}
}
t.textContent = "";
}
// zoom
function zoom_reset(e) {
if (e.attributes != undefined) {
orig_load(e, "x");
orig_load(e, "width");
}
if (e.childNodes == undefined) return;
for (var i = 0, c = e.childNodes; i < c.length; i++) {
zoom_reset(c[i]);
}
}
function zoom_child(e, x, ratio) {
if (e.attributes != undefined) {
if (e.attributes.x != undefined) {
orig_save(e, "x");
e.attributes.x.value = (parseFloat(e.attributes.x.value) - x - 10) * ratio + 10;
if (e.tagName == "text")
e.attributes.x.value = find_child(e.parentNode, "rect[x]").attributes.x.value + 3;
}
if (e.attributes.width != undefined) {
orig_save(e, "width");
e.attributes.width.value = parseFloat(e.attributes.width.value) * ratio;
}
}
if (e.childNodes == undefined) return;
for (var i = 0, c = e.childNodes; i < c.length; i++) {
zoom_child(c[i], x - 10, ratio);
}
}
function zoom_parent(e) {
if (e.attributes) {
if (e.attributes.x != undefined) {
orig_save(e, "x");
e.attributes.x.value = 10;
}
if (e.attributes.width != undefined) {
orig_save(e, "width");
e.attributes.width.value = parseInt(svg.width.baseVal.value) - (10 * 2);
}
}
if (e.childNodes == undefined) return;
for (var i = 0, c = e.childNodes; i < c.length; i++) {
zoom_parent(c[i]);
}
}
function zoom(node) {
var attr = find_child(node, "rect").attributes;
var width = parseFloat(attr.width.value);
var xmin = parseFloat(attr.x.value);
var xmax = parseFloat(xmin + width);
var ymin = parseFloat(attr.y.value);
var ratio = (svg.width.baseVal.value - 2 * 10) / width;
// XXX: Workaround for JavaScript float issues (fix me)
var fudge = 0.0001;
unzoombtn.classList.remove("hide");
var el = document.getElementById("frames").children;
for (var i = 0; i < el.length; i++) {
var e = el[i];
var a = find_child(e, "rect").attributes;
var ex = parseFloat(a.x.value);
var ew = parseFloat(a.width.value);
var upstack;
// Is it an ancestor
if (1 == 1) {
upstack = parseFloat(a.y.value) > ymin;
} else {
upstack = parseFloat(a.y.value) < ymin;
}
if (upstack) {
// Direct ancestor
if (ex <= xmin && (ex+ew+fudge) >= xmax) {
e.classList.add("parent");
zoom_parent(e);
update_text(e);
}
// not in current path
else
e.classList.add("hide");
}
// Children maybe
else {
// no common path
if (ex < xmin || ex + fudge >= xmax) {
e.classList.add("hide");
}
else {
zoom_child(e, xmin, ratio);
update_text(e);
}
}
}
search();
}
function unzoom() {
unzoombtn.classList.add("hide");
var el = document.getElementById("frames").children;
for(var i = 0; i < el.length; i++) {
el[i].classList.remove("parent");
el[i].classList.remove("hide");
zoom_reset(el[i]);
update_text(el[i]);
}
search();
}
// search
function toggle_ignorecase() {
ignorecase = !ignorecase;
if (ignorecase) {
ignorecaseBtn.classList.add("show");
} else {
ignorecaseBtn.classList.remove("show");
}
reset_search();
search();
}
function reset_search() {
var el = document.querySelectorAll("#frames rect");
for (var i = 0; i < el.length; i++) {
orig_load(el[i], "fill")
}
}
function search_prompt() {
if (!searching) {
var term = prompt("Enter a search term (regexp " +
"allowed, eg: ^ext4_)"
+ (ignorecase ? ", ignoring case" : "")
+ "\nPress Ctrl-i to toggle case sensitivity", "");
if (term != null) {
currentSearchTerm = term;
search();
}
} else {
reset_search();
searching = 0;
currentSearchTerm = null;
searchbtn.classList.remove("show");
searchbtn.firstChild.nodeValue = "Search"
matchedtxt.classList.add("hide");
matchedtxt.firstChild.nodeValue = ""
}
}
function search(term) {
if (currentSearchTerm === null) return;
var term = currentSearchTerm;
var re = new RegExp(term, ignorecase ? 'i' : '');
var el = document.getElementById("frames").children;
var matches = new Object();
var maxwidth = 0;
for (var i = 0; i < el.length; i++) {
var e = el[i];
var func = g_to_func(e);
var rect = find_child(e, "rect");
if (func == null || rect == null)
continue;
// Save max width. Only works as we have a root frame
var w = parseFloat(rect.attributes.width.value);
if (w > maxwidth)
maxwidth = w;
if (func.match(re)) {
// highlight
var x = parseFloat(rect.attributes.x.value);
orig_save(rect, "fill");
rect.attributes.fill.value = "rgb(230,0,230)";
// remember matches
if (matches[x] == undefined) {
matches[x] = w;
} else {
if (w > matches[x]) {
// overwrite with parent
matches[x] = w;
}
}
searching = 1;
}
}
if (!searching)
return;
searchbtn.classList.add("show");
searchbtn.firstChild.nodeValue = "Reset Search";
// calculate percent matched, excluding vertical overlap
var count = 0;
var lastx = -1;
var lastw = 0;
var keys = Array();
for (k in matches) {
if (matches.hasOwnProperty(k))
keys.push(k);
}
// sort the matched frames by their x location
// ascending, then width descending
keys.sort(function(a, b){
return a - b;
});
// Step through frames saving only the biggest bottom-up frames
// thanks to the sort order. This relies on the tree property
// where children are always smaller than their parents.
var fudge = 0.0001; // JavaScript floating point
for (var k in keys) {
var x = parseFloat(keys[k]);
var w = matches[keys[k]];
if (x >= lastx + lastw - fudge) {
count += w;
lastx = x;
lastw = w;
}
}
// display matched percent
matchedtxt.classList.remove("hide");
var pct = 100 * count / maxwidth;
if (pct != 100) pct = pct.toFixed(1)
matchedtxt.firstChild.nodeValue = "Matched: " + pct + "%";
}
]]>
</script>
<rect x="0.0" y="0" width="1200.0" height="192.0" fill="url(#background)" />
<text id="title" x="600.00" y="24" >Flame Graph</text>
<text id="unzoom" x="10.00" y="24" class="hide">Reset Zoom</text>
<text id="search" x="1090.00" y="24" >Search</text>
<text id="ignorecase" x="1174.00" y="24" >ic</text>
<text id="matched" x="1090.00" y="179" > </text>
<text id="details" x="10.00" y="179" > </text>
<g id="frames">
<g>
<title></title>
<details>Function: [:0] (86,990 usec, 100.0%); self: 0 usec</details>
<rect x='10.0' y='144' width='1180.0' height='15' fill='rgb(250,211,50)' rx='2' ry='2' />
<text x='13.0' y='154.5'></text>
<rawtext></rawtext>
</g>
<g>
<title>
./benches/ecsgame.luau:1</title>
<details>Function: [./benches/ecsgame.luau:1] (59,386 usec, 68.3%); self: 900 usec</details>
<rect x='10.0' y='128' width='805.5578802161168' height='15' fill='rgb(245,226,25)' rx='2' ry='2' />
<text x='13.0' y='138.5'></text>
<rawtext></rawtext>
</g>
<g>
<title>
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:1</title>
<details>Function: [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:1] (27,604 usec, 31.7%); self: 27,604 usec</details>
<rect x='815.5578802161168' y='128' width='374.4421197838832' height='15' fill='rgb(224,152,32)' rx='2' ry='2' />
<text x='818.5578802161168' y='138.5'></text>
<rawtext></rawtext>
</g>
<g>
<title>update
./benches/ecsgame.luau:117</title>
<details>Function: update [./benches/ecsgame.luau:117] (55,932 usec, 64.3%); self: 48,036 usec</details>
<rect x='10.0' y='112' width='758.7051385216693' height='15' fill='rgb(230,186,52)' rx='2' ry='2' />
<text x='13.0' y='122.5'>update</text>
<rawtext>update</rawtext>
</g>
<g>
<title>entity_create
./benches/ecsgame.luau:83</title>
<details>Function: entity_create [./benches/ecsgame.luau:83] (1,800 usec, 2.1%); self: 0 usec</details>
<rect x='768.7051385216693' y='112' width='24.416599609150477' height='15' fill='rgb(241,106,33)' rx='2' ry='2' />
<text x='771.7051385216693' y='122.5'>e..</text>
<rawtext>entity_create</rawtext>
</g>
<g>
<title>world_new
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2206</title>
<details>Function: world_new [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2206] (100 usec, 0.1%); self: 0 usec</details>
<rect x='801.9931026554776' y='112' width='1.3564777560639154' height='15' fill='rgb(254,140,1)' rx='2' ry='2' />
<text x='804.9931026554776' y='122.5'></text>
<rawtext>world_new</rawtext>
</g>
<g>
<title>require</title>
<details>Function: require [[C]:0] (654 usec, 0.8%); self: 654 usec</details>
<rect x='793.1217381308196' y='112' width='8.871364524658008' height='15' fill='rgb(215,11,48)' rx='2' ry='2' />
<text x='796.1217381308196' y='122.5'></text>
<rawtext>require</rawtext>
</g>
<g>
<title>entity_create
./benches/ecsgame.luau:83</title>
<details>Function: entity_create [./benches/ecsgame.luau:83] (4,195 usec, 4.8%); self: 100 usec</details>
<rect x='10.0' y='96' width='56.90424186688125' height='15' fill='rgb(241,106,33)' rx='2' ry='2' />
<text x='13.0' y='106.5'>entity..</text>
<rawtext>entity_create</rawtext>
</g>
<g>
<title>world_query_iter_next
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:1747</title>
<details>Function: world_query_iter_next [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:1747] (300 usec, 0.3%); self: 300 usec</details>
<rect x='107.61213932635935' y='96' width='4.069433268191746' height='15' fill='rgb(223,177,38)' rx='2' ry='2' />
<text x='110.61213932635935' y='106.5'></text>
<rawtext>world_query_iter_next</rawtext>
</g>
<g>
<title>world_set
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2399</title>
<details>Function: world_set [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2399] (400 usec, 0.5%); self: 400 usec</details>
<rect x='96.76031727784802' y='96' width='5.425911024255662' height='15' fill='rgb(254,21,5)' rx='2' ry='2' />
<text x='99.76031727784802' y='106.5'></text>
<rawtext>world_set</rawtext>
</g>
<g>
<title>world_query_iter_next
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:1798</title>
<details>Function: world_query_iter_next [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:1798] (400 usec, 0.5%); self: 400 usec</details>
<rect x='102.18622830210369' y='96' width='5.425911024255662' height='15' fill='rgb(230,200,34)' rx='2' ry='2' />
<text x='105.18622830210369' y='106.5'></text>
<rawtext>world_query_iter_next</rawtext>
</g>
<g>
<title>query_archetypes
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:1163</title>
<details>Function: query_archetypes [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:1163] (100 usec, 0.1%); self: 100 usec</details>
<rect x='115.75100586274284' y='96' width='1.3564777560639154' height='15' fill='rgb(245,34,30)' rx='2' ry='2' />
<text x='118.75100586274284' y='106.5'></text>
<rawtext>query_archetypes</rawtext>
</g>
<g>
<title>world_delete
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2920</title>
<details>Function: world_delete [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2920] (2,201 usec, 2.5%); self: 1,900 usec</details>
<rect x='66.90424186688125' y='96' width='29.856075410966778' height='15' fill='rgb(206,206,7)' rx='2' ry='2' />
<text x='69.90424186688125' y='106.5'>wo..</text>
<rawtext>world_delete</rawtext>
</g>
<g>
<title>cached_query_iter
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:1667</title>
<details>Function: cached_query_iter [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:1667] (300 usec, 0.3%); self: 300 usec</details>
<rect x='111.6815725945511' y='96' width='4.069433268191746' height='15' fill='rgb(217,4,23)' rx='2' ry='2' />
<text x='114.6815725945511' y='106.5'></text>
<rawtext>cached_query_iter</rawtext>
</g>
<g>
<title>setup_player
./benches/ecsgame.luau:20</title>
<details>Function: setup_player [./benches/ecsgame.luau:20] (100 usec, 0.1%); self: 0 usec</details>
<rect x='790.4087826186918' y='96' width='1.3564777560639154' height='15' fill='rgb(214,78,39)' rx='2' ry='2' />
<text x='793.4087826186918' y='106.5'></text>
<rawtext>setup_player</rawtext>
</g>
<g>
<title>world_entity
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2825</title>
<details>Function: world_entity [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2825] (400 usec, 0.5%); self: 100 usec</details>
<rect x='784.9828715944361' y='96' width='5.425911024255662' height='15' fill='rgb(231,182,30)' rx='2' ry='2' />
<text x='787.9828715944361' y='106.5'></text>
<rawtext>world_entity</rawtext>
</g>
<g>
<title>setup_goblin
./benches/ecsgame.luau:42</title>
<details>Function: setup_goblin [./benches/ecsgame.luau:42] (100 usec, 0.1%); self: 0 usec</details>
<rect x='791.7652603747557' y='96' width='1.3564777560639154' height='15' fill='rgb(222,70,48)' rx='2' ry='2' />
<text x='794.7652603747557' y='106.5'></text>
<rawtext>setup_goblin</rawtext>
</g>
<g>
<title>setup_wood_spikes
./benches/ecsgame.luau:65</title>
<details>Function: setup_wood_spikes [./benches/ecsgame.luau:65] (1,200 usec, 1.4%); self: 200 usec</details>
<rect x='768.7051385216693' y='96' width='16.277733072766985' height='15' fill='rgb(239,186,21)' rx='2' ry='2' />
<text x='771.7051385216693' y='106.5'></text>
<rawtext>setup_wood_spikes</rawtext>
</g>
<g>
<title>world_add
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2501</title>
<details>Function: world_add [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2501] (100 usec, 0.1%); self: 100 usec</details>
<rect x='801.9931026554776' y='96' width='1.3564777560639154' height='15' fill='rgb(242,210,13)' rx='2' ry='2' />
<text x='804.9931026554776' y='106.5'></text>
<rawtext>world_add</rawtext>
</g>
<g>
<title>setup_goblin
./benches/ecsgame.luau:42</title>
<details>Function: setup_goblin [./benches/ecsgame.luau:42] (2,563 usec, 2.9%); self: 400 usec</details>
<rect x='10.0' y='80' width='34.76652488791815' height='15' fill='rgb(222,70,48)' rx='2' ry='2' />
<text x='13.0' y='90.5'>se..</text>
<rawtext>setup_goblin</rawtext>
</g>
<g>
<title>world_entity
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2825</title>
<details>Function: world_entity [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2825] (102 usec, 0.1%); self: 102 usec</details>
<rect x='64.16415679963214' y='80' width='1.3836073111851936' height='15' fill='rgb(231,182,30)' rx='2' ry='2' />
<text x='67.16415679963214' y='90.5'></text>
<rawtext>world_entity</rawtext>
</g>
<g>
<title>setup_player
./benches/ecsgame.luau:20</title>
<details>Function: setup_player [./benches/ecsgame.luau:20] (1,430 usec, 1.6%); self: 100 usec</details>
<rect x='44.76652488791815' y='80' width='19.39763191171399' height='15' fill='rgb(214,78,39)' rx='2' ry='2' />
<text x='47.76652488791815' y='90.5'></text>
<rawtext>setup_player</rawtext>
</g>
<g>
<title>archetype_delete
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:1095</title>
<details>Function: archetype_delete [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:1095] (301 usec, 0.3%); self: 301 usec</details>
<rect x='66.90424186688125' y='80' width='4.082998045752386' height='15' fill='rgb(253,214,43)' rx='2' ry='2' />
<text x='69.90424186688125' y='90.5'></text>
<rawtext>archetype_delete</rawtext>
</g>
<g>
<title>ecs_bulk_insert
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2080</title>
<details>Function: ecs_bulk_insert [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2080] (100 usec, 0.1%); self: 100 usec</details>
<rect x='790.4087826186918' y='80' width='1.3564777560639154' height='15' fill='rgb(235,105,37)' rx='2' ry='2' />
<text x='793.4087826186918' y='90.5'></text>
<rawtext>ecs_bulk_insert</rawtext>
</g>
<g>
<title>entity_index_new_id
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2254</title>
<details>Function: entity_index_new_id [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2254] (300 usec, 0.3%); self: 100 usec</details>
<rect x='784.9828715944361' y='80' width='4.069433268191746' height='15' fill='rgb(217,39,3)' rx='2' ry='2' />
<text x='787.9828715944361' y='90.5'></text>
<rawtext>entity_index_new_id</rawtext>
</g>
<g>
<title>ecs_bulk_insert
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2080</title>
<details>Function: ecs_bulk_insert [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2080] (100 usec, 0.1%); self: 100 usec</details>
<rect x='791.7652603747557' y='80' width='1.3564777560639154' height='15' fill='rgb(235,105,37)' rx='2' ry='2' />
<text x='794.7652603747557' y='90.5'></text>
<rawtext>ecs_bulk_insert</rawtext>
</g>
<g>
<title>ecs_bulk_insert
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2080</title>
<details>Function: ecs_bulk_insert [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2080] (1,000 usec, 1.1%); self: 900 usec</details>
<rect x='768.7051385216693' y='80' width='13.564777560639154' height='15' fill='rgb(235,105,37)' rx='2' ry='2' />
<text x='771.7051385216693' y='90.5'></text>
<rawtext>ecs_bulk_insert</rawtext>
</g>
<g>
<title>ecs_bulk_insert
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2080</title>
<details>Function: ecs_bulk_insert [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2080] (2,063 usec, 2.4%); self: 2,063 usec</details>
<rect x='10.0' y='64' width='27.984136107598577' height='15' fill='rgb(235,105,37)' rx='2' ry='2' />
<text x='13.0' y='74.5'>e..</text>
<rawtext>ecs_bulk_insert</rawtext>
</g>
<g>
<title>GC</title>
<details>Function: GC [GC:0] (100 usec, 0.1%); self: 100 usec</details>
<rect x='37.98413610759857' y='64' width='1.3564777560639154' height='15' fill='rgb(226,66,24)' rx='2' ry='2' />
<text x='40.98413610759857' y='74.5'></text>
<rawtext>GC</rawtext>
</g>
<g>
<title>ecs_bulk_insert
C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2080</title>
<details>Function: ecs_bulk_insert [C:/Users/Marcus/Documents/packages/jecs/jecs.luau:2080] (1,230 usec, 1.4%); self: 1,130 usec</details>
<rect x='44.76652488791815' y='64' width='16.68467639958616' height='15' fill='rgb(235,105,37)' rx='2' ry='2' />
<text x='47.76652488791815' y='74.5'></text>
<rawtext>ecs_bulk_insert</rawtext>
</g>
<g>
<title>GC</title>
<details>Function: GC [GC:0] (100 usec, 0.1%); self: 100 usec</details>
<rect x='61.45120128750431' y='64' width='1.3564777560639154' height='15' fill='rgb(226,66,24)' rx='2' ry='2' />
<text x='64.45120128750432' y='74.5'></text>
<rawtext>GC</rawtext>
</g>
<g>
<title>GC</title>
<details>Function: GC [GC:0] (200 usec, 0.2%); self: 200 usec</details>
<rect x='784.9828715944361' y='64' width='2.712955512127831' height='15' fill='rgb(226,66,24)' rx='2' ry='2' />
<text x='787.9828715944361' y='74.5'></text>
<rawtext>GC</rawtext>
</g>
<g>
<title>concat</title>
<details>Function: concat [[C]:0] (100 usec, 0.1%); self: 0 usec</details>
<rect x='768.7051385216693' y='64' width='1.3564777560639154' height='15' fill='rgb(205,188,26)' rx='2' ry='2' />
<text x='771.7051385216693' y='74.5'></text>
<rawtext>concat</rawtext>
</g>
<g>
<title>concat</title>
<details>Function: concat [[C]:0] (100 usec, 0.1%); self: 0 usec</details>
<rect x='44.76652488791815' y='48' width='1.3564777560639154' height='15' fill='rgb(205,188,26)' rx='2' ry='2' />
<text x='47.76652488791815' y='58.5'></text>
<rawtext>concat</rawtext>
</g>
<g>
<title>GC</title>
<details>Function: GC [GC:0] (100 usec, 0.1%); self: 100 usec</details>
<rect x='768.7051385216693' y='48' width='1.3564777560639154' height='15' fill='rgb(226,66,24)' rx='2' ry='2' />
<text x='771.7051385216693' y='58.5'></text>
<rawtext>GC</rawtext>
</g>
<g>
<title>GC</title>
<details>Function: GC [GC:0] (100 usec, 0.1%); self: 100 usec</details>
<rect x='44.76652488791815' y='32' width='1.3564777560639154' height='15' fill='rgb(226,66,24)' rx='2' ry='2' />
<text x='47.76652488791815' y='42.5'></text>
<rawtext>GC</rawtext>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 26 KiB

430
perf2.svg Executable file
View file

@ -0,0 +1,430 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" width="1200" height="144" onload="init(evt)" viewBox="0 0 1200 144" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Flame graph stack visualization. See https://github.com/brendangregg/FlameGraph for latest version, and http://www.brendangregg.com/flamegraphs.html for examples. -->
<defs>
<linearGradient id="background" y1="0" y2="1" x1="0" x2="0" >
<stop stop-color="#eeeeee" offset="5%" />
<stop stop-color="#eeeeb0" offset="95%" />
</linearGradient>
</defs>
<style type="text/css">
text { font-family:Verdana; font-size:12px; fill:rgb(0,0,0); }
#search, #ignorecase { opacity:0.1; cursor:pointer; }
#search:hover, #search.show, #ignorecase:hover, #ignorecase.show { opacity:1; }
#subtitle { text-anchor:middle; font-color:rgb(160,160,160); }
#title { text-anchor:middle; font-size:17px}
#unzoom { cursor:pointer; }
#frames > *:hover { stroke:black; stroke-width:0.5; cursor:pointer; }
.hide { display:none; }
.parent { opacity:0.5; }
</style>
<script type="text/ecmascript">
<![CDATA[
"use strict";
var details, searchbtn, unzoombtn, matchedtxt, svg, searching, currentSearchTerm, ignorecase, ignorecaseBtn;
function init(evt) {
details = document.getElementById("details").firstChild;
searchbtn = document.getElementById("search");
ignorecaseBtn = document.getElementById("ignorecase");
unzoombtn = document.getElementById("unzoom");
matchedtxt = document.getElementById("matched");
svg = document.getElementsByTagName("svg")[0];
searching = 0;
currentSearchTerm = null;
}
window.addEventListener("click", function(e) {
var target = find_group(e.target);
if (target) {
if (target.nodeName == "a") {
if (e.ctrlKey === false) return;
e.preventDefault();
}
if (target.classList.contains("parent")) unzoom();
zoom(target);
}
else if (e.target.id == "unzoom") unzoom();
else if (e.target.id == "search") search_prompt();
else if (e.target.id == "ignorecase") toggle_ignorecase();
}, false)
// mouse-over for info
// show
window.addEventListener("mouseover", function(e) {
var target = find_group(e.target);
if (target) details.nodeValue = g_to_text(target);
}, false)
// clear
window.addEventListener("mouseout", function(e) {
var target = find_group(e.target);
if (target) details.nodeValue = ' ';
}, false)
// ctrl-F for search
window.addEventListener("keydown",function (e) {
if (e.keyCode === 114 || (e.ctrlKey && e.keyCode === 70)) {
e.preventDefault();
search_prompt();
}
}, false)
// ctrl-I to toggle case-sensitive search
window.addEventListener("keydown",function (e) {
if (e.ctrlKey && e.keyCode === 73) {
e.preventDefault();
toggle_ignorecase();
}
}, false)
// functions
function find_child(node, selector) {
var children = node.querySelectorAll(selector);
if (children.length) return children[0];
return;
}
function find_group(node) {
var parent = node.parentElement;
if (!parent) return;
if (parent.id == "frames") return node;
return find_group(parent);
}
function orig_save(e, attr, val) {
if (e.attributes["_orig_" + attr] != undefined) return;
if (e.attributes[attr] == undefined) return;
if (val == undefined) val = e.attributes[attr].value;
e.setAttribute("_orig_" + attr, val);
}
function orig_load(e, attr) {
if (e.attributes["_orig_"+attr] == undefined) return;
e.attributes[attr].value = e.attributes["_orig_" + attr].value;
e.removeAttribute("_orig_"+attr);
}
function g_to_text(e) {
var text = find_child(e, "details").firstChild.nodeValue;
return (text)
}
function g_to_func(e) {
var child = find_child(e, "rawtext");
return child ? child.textContent : null;
}
function update_text(e) {
var r = find_child(e, "rect");
var t = find_child(e, "text");
var w = parseFloat(r.attributes.width.value) -3;
var txt = find_child(e, "rawtext").textContent.replace(/\([^(]*\)$/,"");
t.attributes.x.value = parseFloat(r.attributes.x.value) + 3;
// Smaller than this size won't fit anything
if (w < 2 * 12 * 0.59) {
t.textContent = "";
return;
}
t.textContent = txt;
// Fit in full text width
if (/^ *$/.test(txt) || t.getSubStringLength(0, txt.length) < w)
return;
for (var x = txt.length - 2; x > 0; x--) {
if (t.getSubStringLength(0, x + 2) <= w) {
t.textContent = txt.substring(0, x) + "..";
return;
}
}
t.textContent = "";
}
// zoom
function zoom_reset(e) {
if (e.attributes != undefined) {
orig_load(e, "x");
orig_load(e, "width");
}
if (e.childNodes == undefined) return;
for (var i = 0, c = e.childNodes; i < c.length; i++) {
zoom_reset(c[i]);
}
}
function zoom_child(e, x, ratio) {
if (e.attributes != undefined) {
if (e.attributes.x != undefined) {
orig_save(e, "x");
e.attributes.x.value = (parseFloat(e.attributes.x.value) - x - 10) * ratio + 10;
if (e.tagName == "text")
e.attributes.x.value = find_child(e.parentNode, "rect[x]").attributes.x.value + 3;
}
if (e.attributes.width != undefined) {
orig_save(e, "width");
e.attributes.width.value = parseFloat(e.attributes.width.value) * ratio;
}
}
if (e.childNodes == undefined) return;
for (var i = 0, c = e.childNodes; i < c.length; i++) {
zoom_child(c[i], x - 10, ratio);
}
}
function zoom_parent(e) {
if (e.attributes) {
if (e.attributes.x != undefined) {
orig_save(e, "x");
e.attributes.x.value = 10;
}
if (e.attributes.width != undefined) {
orig_save(e, "width");
e.attributes.width.value = parseInt(svg.width.baseVal.value) - (10 * 2);
}
}
if (e.childNodes == undefined) return;
for (var i = 0, c = e.childNodes; i < c.length; i++) {
zoom_parent(c[i]);
}
}
function zoom(node) {
var attr = find_child(node, "rect").attributes;
var width = parseFloat(attr.width.value);
var xmin = parseFloat(attr.x.value);
var xmax = parseFloat(xmin + width);
var ymin = parseFloat(attr.y.value);
var ratio = (svg.width.baseVal.value - 2 * 10) / width;
// XXX: Workaround for JavaScript float issues (fix me)
var fudge = 0.0001;
unzoombtn.classList.remove("hide");
var el = document.getElementById("frames").children;
for (var i = 0; i < el.length; i++) {
var e = el[i];
var a = find_child(e, "rect").attributes;
var ex = parseFloat(a.x.value);
var ew = parseFloat(a.width.value);
var upstack;
// Is it an ancestor
if (1 == 1) {
upstack = parseFloat(a.y.value) > ymin;
} else {
upstack = parseFloat(a.y.value) < ymin;
}
if (upstack) {
// Direct ancestor
if (ex <= xmin && (ex+ew+fudge) >= xmax) {
e.classList.add("parent");
zoom_parent(e);
update_text(e);
}
// not in current path
else
e.classList.add("hide");
}
// Children maybe
else {
// no common path
if (ex < xmin || ex + fudge >= xmax) {
e.classList.add("hide");
}
else {
zoom_child(e, xmin, ratio);
update_text(e);
}
}
}
search();
}
function unzoom() {
unzoombtn.classList.add("hide");
var el = document.getElementById("frames").children;
for(var i = 0; i < el.length; i++) {
el[i].classList.remove("parent");
el[i].classList.remove("hide");
zoom_reset(el[i]);
update_text(el[i]);
}
search();
}
// search
function toggle_ignorecase() {
ignorecase = !ignorecase;
if (ignorecase) {
ignorecaseBtn.classList.add("show");
} else {
ignorecaseBtn.classList.remove("show");
}
reset_search();
search();
}
function reset_search() {
var el = document.querySelectorAll("#frames rect");
for (var i = 0; i < el.length; i++) {
orig_load(el[i], "fill")
}
}
function search_prompt() {
if (!searching) {
var term = prompt("Enter a search term (regexp " +
"allowed, eg: ^ext4_)"
+ (ignorecase ? ", ignoring case" : "")
+ "\nPress Ctrl-i to toggle case sensitivity", "");
if (term != null) {
currentSearchTerm = term;
search();
}
} else {
reset_search();
searching = 0;
currentSearchTerm = null;
searchbtn.classList.remove("show");
searchbtn.firstChild.nodeValue = "Search"
matchedtxt.classList.add("hide");
matchedtxt.firstChild.nodeValue = ""
}
}
function search(term) {
if (currentSearchTerm === null) return;
var term = currentSearchTerm;
var re = new RegExp(term, ignorecase ? 'i' : '');
var el = document.getElementById("frames").children;
var matches = new Object();
var maxwidth = 0;
for (var i = 0; i < el.length; i++) {
var e = el[i];
var func = g_to_func(e);
var rect = find_child(e, "rect");
if (func == null || rect == null)
continue;
// Save max width. Only works as we have a root frame
var w = parseFloat(rect.attributes.width.value);
if (w > maxwidth)
maxwidth = w;
if (func.match(re)) {
// highlight
var x = parseFloat(rect.attributes.x.value);
orig_save(rect, "fill");
rect.attributes.fill.value = "rgb(230,0,230)";
// remember matches
if (matches[x] == undefined) {
matches[x] = w;
} else {
if (w > matches[x]) {
// overwrite with parent
matches[x] = w;
}
}
searching = 1;
}
}
if (!searching)
return;
searchbtn.classList.add("show");
searchbtn.firstChild.nodeValue = "Reset Search";
// calculate percent matched, excluding vertical overlap
var count = 0;
var lastx = -1;
var lastw = 0;
var keys = Array();
for (k in matches) {
if (matches.hasOwnProperty(k))
keys.push(k);
}
// sort the matched frames by their x location
// ascending, then width descending
keys.sort(function(a, b){
return a - b;
});
// Step through frames saving only the biggest bottom-up frames
// thanks to the sort order. This relies on the tree property
// where children are always smaller than their parents.
var fudge = 0.0001; // JavaScript floating point
for (var k in keys) {
var x = parseFloat(keys[k]);
var w = matches[keys[k]];
if (x >= lastx + lastw - fudge) {
count += w;
lastx = x;
lastw = w;
}
}
// display matched percent
matchedtxt.classList.remove("hide");
var pct = 100 * count / maxwidth;
if (pct != 100) pct = pct.toFixed(1)
matchedtxt.firstChild.nodeValue = "Matched: " + pct + "%";
}
]]>
</script>
<rect x="0.0" y="0" width="1200.0" height="144.0" fill="url(#background)" />
<text id="title" x="600.00" y="24" >Flame Graph</text>
<text id="unzoom" x="10.00" y="24" class="hide">Reset Zoom</text>
<text id="search" x="1090.00" y="24" >Search</text>
<text id="ignorecase" x="1174.00" y="24" >ic</text>
<text id="matched" x="1090.00" y="131" > </text>
<text id="details" x="10.00" y="131" > </text>
<g id="frames">
<g>
<title></title>
<details>Function: [:0] (33,030,510 usec, 100.0%); self: 0 usec</details>
<rect x='10.0' y='96' width='1180.0' height='15' fill='rgb(250,211,50)' rx='2' ry='2' />
<text x='13.0' y='106.5'></text>
<rawtext></rawtext>
</g>
<g>
<title>
./benches/smallgame.luau:1</title>
<details>Function: [./benches/smallgame.luau:1] (33,030,510 usec, 100.0%); self: 2,214 usec</details>
<rect x='10.0' y='80' width='1180.0' height='15' fill='rgb(228,125,3)' rx='2' ry='2' />
<text x='13.0' y='90.5'></text>
<rawtext></rawtext>
</g>
<g>
<title>entity_create
./benches/smallgame.luau:120</title>
<details>Function: entity_create [./benches/smallgame.luau:120] (2,900 usec, 0.0%); self: 2,400 usec</details>
<rect x='1189.8137322130358' y='64' width='0.10360118569165297' height='15' fill='rgb(237,134,10)' rx='2' ry='2' />
<text x='1192.8137322130358' y='74.5'></text>
<rawtext>entity_create</rawtext>
</g>
<g>
<title>update
./benches/smallgame.luau:176</title>
<details>Function: update [./benches/smallgame.luau:176] (33,025,296 usec, 100.0%); self: 134,690 usec</details>
<rect x='10.0' y='64' width='1179.8137322130358' height='15' fill='rgb(244,133,1)' rx='2' ry='2' />
<text x='13.0' y='74.5'>update</text>
<rawtext>update</rawtext>
</g>
<g>
<title>
./benches/smallgame.luau:104</title>
<details>Function: [./benches/smallgame.luau:104] (23,826,193 usec, 72.1%); self: 23,826,193 usec</details>
<rect x='10.0' y='48' width='851.1799466614351' height='15' fill='rgb(249,157,38)' rx='2' ry='2' />
<text x='13.0' y='58.5'></text>
<rawtext></rawtext>
</g>
<g>
<title>entity_create
./benches/smallgame.luau:120</title>
<details>Function: entity_create [./benches/smallgame.luau:120] (16,987 usec, 0.1%); self: 15,984 usec</details>
<rect x='1184.3629880374235' y='48' width='0.6068528763255547' height='15' fill='rgb(237,134,10)' rx='2' ry='2' />
<text x='1187.3629880374235' y='58.5'></text>
<rawtext>entity_create</rawtext>
</g>
<g>
<title>
./benches/smallgame.luau:60</title>
<details>Function: [./benches/smallgame.luau:60] (9,046,526 usec, 27.4%); self: 9,046,526 usec</details>
<rect x='861.1799466614351' y='48' width='323.18304137598847' height='15' fill='rgb(239,125,8)' rx='2' ry='2' />
<text x='864.1799466614351' y='58.5'></text>
<rawtext></rawtext>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.