summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2023-05-10 21:06:46 +0300
committermattip <matti.picus@gmail.com>2023-05-10 21:41:48 +0300
commit670842b38005febf64259f268332e46d86233ef0 (patch)
tree75aefd3fd4748f89b9327a5107c18f0f369138d7 /benchmarks
parent181c15b294d6dd164e4c41ddbb1c5feae9b5beee (diff)
downloadnumpy-670842b38005febf64259f268332e46d86233ef0.tar.gz
add fast path for str(scalar_int)
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/benchmarks/bench_scalar.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/benchmarks/benchmarks/bench_scalar.py b/benchmarks/benchmarks/bench_scalar.py
index 650daa89d..d68f934cb 100644
--- a/benchmarks/benchmarks/bench_scalar.py
+++ b/benchmarks/benchmarks/bench_scalar.py
@@ -65,3 +65,13 @@ class ScalarMath(Benchmark):
other + int32
other + int32
other + int32
+
+class ScalarStr(Benchmark):
+ # Test scalar to str conversion
+ params = [TYPES1]
+ param_names = ["type"]
+ def setup(self, typename):
+ self.a = np.array([100] * 100, dtype=typename)
+
+ def time_str_repr(self, typename):
+ res = [str(x) for x in self.a]