From 834d10f5ee0e790ff019494bd0055e8fcb1f4cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ingvar=20Dahlgren?= <bjodah@gmail.com> Date: Tue, 12 Nov 2024 22:22:38 +0100 Subject: [PATCH 1/2] Add benchmark of Add --- benchmarks/core.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/benchmarks/core.py b/benchmarks/core.py index cfc1c85..b156f33 100644 --- a/benchmarks/core.py +++ b/benchmarks/core.py @@ -15,6 +15,11 @@ def time_neg(self): def time_Add_x1(self): x + 1 + def time_Add_thousands(self): + # from https://github.com/sympy/sympy/pull/27254 + a = symbols("a0:2000") + b = Add(*a); + b + a[0] def time_Add_1x(self): 1 + x From a8bfd5eff83055b594e7f608f4cd5a1c23a20565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ingvar=20Dahlgren?= <bjodah@gmail.com> Date: Wed, 13 Nov 2024 22:34:38 +0100 Subject: [PATCH 2/2] only benchmark single addition in time_Add_thousands --- benchmarks/core/arit.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/benchmarks/core/arit.py b/benchmarks/core/arit.py index 1d4cc9b..a0307cb 100644 --- a/benchmarks/core/arit.py +++ b/benchmarks/core/arit.py @@ -8,6 +8,10 @@ p = 3*x**2*y*z**7 + 7*x*y*z**2 + 4*x + x*y**4 e = (x + y + z + 1)**32 +a5000 = symbols("a0:5000") +sum_a5000 = Add(*a5000); + + class Time_Arit: def time_neg(self): -x @@ -29,9 +33,7 @@ def time_Add_xyz(self): def time_Add_thousands(self): # from https://github.com/sympy/sympy/pull/27254 - a = symbols("a0:2000") - b = Add(*a); - b + a[0] + sum_a5000 + a5000[0] def time_Mul_xy(self): x*y