summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2025-04-16 18:27:38 -0700
committerJohn Hawthorn <john@hawthorn.email>2025-04-18 13:03:54 +0900
commit3a29e835e69187330bb3fee035f1289561de5dad (patch)
tree505cf6ab9c28ce1095a982205f1c485a7cc3b3c0
parent57b6a7503f19a9ffb53b1c505c7e093d7a6e33a4 (diff)
Add benchmarks for fstring de-duplication
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12921
-rw-r--r--benchmark/ractor_string_fstring.yml18
-rw-r--r--benchmark/string_fstring.yml16
2 files changed, 34 insertions, 0 deletions
diff --git a/benchmark/ractor_string_fstring.yml b/benchmark/ractor_string_fstring.yml
new file mode 100644
index 0000000000..14b92d8fd8
--- /dev/null
+++ b/benchmark/ractor_string_fstring.yml
@@ -0,0 +1,18 @@
+type: lib/benchmark_driver/runner/ractor
+benchmark:
+ ractor_fstring_random: |
+ i = 0
+ str = "same".dup
+ while i < 2000000
+ -(i.to_s.freeze)
+ i += 1
+ end
+ ractor_fstring_same: |
+ i = 0
+ str = "same".dup
+ while i < 2000000
+ -str
+ i += 1
+ end
+loop_count: 1
+ractor: 4
diff --git a/benchmark/string_fstring.yml b/benchmark/string_fstring.yml
new file mode 100644
index 0000000000..cafef1f3fe
--- /dev/null
+++ b/benchmark/string_fstring.yml
@@ -0,0 +1,16 @@
+benchmark:
+ fstring_random: |
+ i = 0
+ str = "same".dup
+ while i < 5_000_000
+ -(i.to_s.freeze)
+ i += 1
+ end
+ fstring_same: |
+ i = 0
+ str = "same".dup
+ while i < 10_000_000
+ -str
+ i += 1
+ end
+loop_count: 1