From b2ceab46fbda95a1d20b2cc1ba4b31b50403fc50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Juli=C3=A1n=20Merelo=20Guerv=C3=B3s?= Date: Sun, 26 Oct 2025 08:50:50 +0100 Subject: [PATCH] Broadcast is not needed when its two elements are scalars And it might have an impact in performance. --- src/BBOBFunction.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BBOBFunction.jl b/src/BBOBFunction.jl index c19ef0c..0c67550 100644 --- a/src/BBOBFunction.jl +++ b/src/BBOBFunction.jl @@ -117,7 +117,7 @@ end @define_x_and_f_opt(1) """ Sphere Function """ -f1(x) = ∑( (x[i] .- x1_opt[i])^2 for i=1:length(x) ) + f1_opt +f1(x) = ∑( (x[i] - x1_opt[i])^2 for i=1:length(x) ) + f1_opt @BBOBFunction("Sphere", "sphere", 1) @@ -432,4 +432,4 @@ end ## Compile time tests -map(test_x_opt, BBOBFunctions) \ No newline at end of file +map(test_x_opt, BBOBFunctions)