From 9f50ad9208995e0fe9ed4c0ca38352933580ed56 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sat, 17 Feb 2024 19:20:48 +0200 Subject: [PATCH] LibGfx/ICC: Stop allocating a vector on each call to lerp_nd While all callers of lerp_nd created a Vector with inline_capacity of 4 to ensure no heap allocation will take place for most inputs, lerp_nd requested a reference to a Vector with 0 inline_capacity, which meant a new vector was allocated on each call. --- Userland/Libraries/LibGfx/ICC/TagTypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGfx/ICC/TagTypes.h b/Userland/Libraries/LibGfx/ICC/TagTypes.h index 010f16e11b..a1b59edb68 100644 --- a/Userland/Libraries/LibGfx/ICC/TagTypes.h +++ b/Userland/Libraries/LibGfx/ICC/TagTypes.h @@ -35,7 +35,7 @@ float lerp_1d(ReadonlySpan values, float x) // Does multi-dimensional linear interpolation over a lookup table. // `size(i)` should returns the number of samples in the i'th dimension. // `sample()` gets a vector where 0 <= i'th coordinate < size(i) and should return the value of the look-up table at that position. -inline FloatVector3 lerp_nd(Function size, Function const&)> sample, Vector const& x) +inline FloatVector3 lerp_nd(Function size, Function const&)> sample, ReadonlySpan x) { unsigned left_index[x.size()]; float factor[x.size()];