From ea5e6aecc58e3c9494488c2a653bdfc40c6aad87 Mon Sep 17 00:00:00 2001 From: Max Cahill Date: Mon, 30 Sep 2024 14:35:55 +1000 Subject: [PATCH 1/6] dropped the maximum steps for manual gc --- manual_gc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual_gc.lua b/manual_gc.lua index f392845..b698268 100644 --- a/manual_gc.lua +++ b/manual_gc.lua @@ -41,7 +41,7 @@ return function(time_budget, memory_ceiling, disable_otherwise) time_budget = time_budget or 1e-3 memory_ceiling = memory_ceiling or math.huge - local max_steps = 1000 + local max_steps = 100 local steps = 0 local start_time = love.timer.getTime() while From 310af508bd4bd7a640ee5c6560cafc5c340834b6 Mon Sep 17 00:00:00 2001 From: Max Cahill Date: Thu, 3 Oct 2024 17:12:41 +1000 Subject: [PATCH 2/6] remove a pointless comparison --- state_machine.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/state_machine.lua b/state_machine.lua index fcebed1..bd04ed1 100644 --- a/state_machine.lua +++ b/state_machine.lua @@ -65,7 +65,7 @@ end function state_machine:_call_and_transition(name, ...) local r = self:_call(name, ...) if type(r) == "string" and self:has_state(r) then - self:set_state(r, r == self.current_state_name) + self:set_state(r, true) return nil end return r From c573c79d32fe39e1e2fea455e18a9795bd0107e9 Mon Sep 17 00:00:00 2001 From: Max Cahill Date: Fri, 11 Oct 2024 23:30:20 +1100 Subject: [PATCH 3/6] added manual gc early-outs if a collection finishes --- manual_gc.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manual_gc.lua b/manual_gc.lua index b698268..0cd5ece 100644 --- a/manual_gc.lua +++ b/manual_gc.lua @@ -48,7 +48,9 @@ return function(time_budget, memory_ceiling, disable_otherwise) love.timer.getTime() - start_time < time_budget and steps < max_steps do - collectgarbage("step", 1) + if collectgarbage("step", 1) then + break + end steps = steps + 1 end --safety net From 708e11df0b3f2d85b15c00b5333f24afb51472e8 Mon Sep 17 00:00:00 2001 From: Max Cahill Date: Fri, 18 Oct 2024 15:26:54 +1100 Subject: [PATCH 4/6] early-out non-rotations for vec3:rotatei (common for manual euler transforms) --- vec3.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vec3.lua b/vec3.lua index ca14260..6c5d8f9 100644 --- a/vec3.lua +++ b/vec3.lua @@ -328,6 +328,9 @@ end --rotate around a swizzle --todo: angle-axis version function vec3:rotatei(swizzle, angle) + if angle == 0 then --early out + return self + end local v = vec2:pooled() self:extract_vec2(swizzle, v) v:rotatei(angle) From 137ef43787500348dee827c0c511123d176dfdee Mon Sep 17 00:00:00 2001 From: Max Cahill Date: Fri, 25 Oct 2024 14:54:29 +1100 Subject: [PATCH 5/6] allowed more max steps for manual_gc again --- manual_gc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual_gc.lua b/manual_gc.lua index 0cd5ece..706a0fb 100644 --- a/manual_gc.lua +++ b/manual_gc.lua @@ -41,7 +41,7 @@ return function(time_budget, memory_ceiling, disable_otherwise) time_budget = time_budget or 1e-3 memory_ceiling = memory_ceiling or math.huge - local max_steps = 100 + local max_steps = 1000 local steps = 0 local start_time = love.timer.getTime() while From aa5273fcc7ea5715f3325648cd9f4f2af7a11107 Mon Sep 17 00:00:00 2001 From: Max Cahill Date: Fri, 25 Oct 2024 14:54:45 +1100 Subject: [PATCH 6/6] inlined euler rotation for speed --- vec3.lua | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/vec3.lua b/vec3.lua index 6c5d8f9..9b0ee08 100644 --- a/vec3.lua +++ b/vec3.lua @@ -339,19 +339,10 @@ function vec3:rotatei(swizzle, angle) return self end -local _euler_macro = { - "yz", - "xz", - "xy", -} function vec3:rotate_euleri(angle_x_axis, angle_y_axis, angle_z_axis) - for i, swizzle in ipairs(_euler_macro) do - local angle = - i == 1 and angle_x_axis - or i == 2 and angle_y_axis - or i == 3 and angle_z_axis - self:rotatei(swizzle, angle) - end + self:rotatei("yz", angle_x_axis) + self:rotatei("xz", angle_y_axis) + self:rotatei("xy", angle_z_axis) return self end