[前][次][番号順一覧][スレッド一覧]

ruby-changes:60237

From: Nobuyoshi <ko1@a...>
Date: Sat, 29 Feb 2020 15:42:51 +0900 (JST)
Subject: [ruby-changes:60237] 5e897227ff (master): Added more benchmarks for String

https://git.ruby-lang.org/ruby.git/commit/?id=5e897227ff

From 5e897227ff3d37a36be96bb2c082370d437058ea Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 29 Feb 2020 15:41:36 +0900
Subject: Added more benchmarks for String


diff --git a/benchmark/string_casecmp.yml b/benchmark/string_casecmp.yml
new file mode 100644
index 0000000..2354040
--- /dev/null
+++ b/benchmark/string_casecmp.yml
@@ -0,0 +1,26 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/string_casecmp.yml#L1
+prelude: |
+  lstr1 = [*"a".."z",*"0".."9"].join("")
+  lstr10 = lstr1 * 10
+  lstr100 = lstr10 * 10
+  lstr1000 = lstr100 * 10
+  lnonascii1 = [*"\u{e0}".."\u{ff}"].join("")
+  lnonascii10 = lnonascii1 * 10
+  lnonascii100 = lnonascii10 * 10
+  lnonascii1000 = lnonascii100 * 10
+  ustr1 = [*"A".."Z",*"0".."9"].join("")
+  ustr10 = ustr1 * 10
+  ustr100 = ustr10 * 10
+  ustr1000 = ustr100 * 10
+  unonascii1 = [*"\u{c0}".."\u{df}"].join("")
+  unonascii10 = unonascii1 * 10
+  unonascii100 = unonascii10 * 10
+  unonascii1000 = unonascii100 * 10
+benchmark:
+  casecmp-1: lstr1.casecmp(ustr1)
+  casecmp-10: lstr10.casecmp(ustr10)
+  casecmp-100: lstr100.casecmp(ustr100)
+  casecmp-1000: lstr1000.casecmp(ustr1000)
+  casecmp-nonascii1: lnonascii1.casecmp(unonascii1)
+  casecmp-nonascii10: lnonascii10.casecmp(unonascii10)
+  casecmp-nonascii100: lnonascii100.casecmp(unonascii100)
+  casecmp-nonascii1000: lnonascii1000.casecmp(unonascii1000)
diff --git a/benchmark/string_casecmp_p.yml b/benchmark/string_casecmp_p.yml
new file mode 100644
index 0000000..a790ce7
--- /dev/null
+++ b/benchmark/string_casecmp_p.yml
@@ -0,0 +1,26 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/string_casecmp_p.yml#L1
+prelude: |
+  lstr1 = [*"a".."z",*"0".."9"].join("")
+  lstr10 = lstr1 * 10
+  lstr100 = lstr10 * 10
+  lstr1000 = lstr100 * 10
+  lnonascii1 = [*"\u{e0}".."\u{ff}"].join("")
+  lnonascii10 = lnonascii1 * 10
+  lnonascii100 = lnonascii10 * 10
+  lnonascii1000 = lnonascii100 * 10
+  ustr1 = [*"A".."Z",*"0".."9"].join("")
+  ustr10 = ustr1 * 10
+  ustr100 = ustr10 * 10
+  ustr1000 = ustr100 * 10
+  unonascii1 = [*"\u{c0}".."\u{df}"].join("")
+  unonascii10 = unonascii1 * 10
+  unonascii100 = unonascii10 * 10
+  unonascii1000 = unonascii100 * 10
+benchmark:
+  casecmp_p-1: lstr1.casecmp?(ustr1)
+  casecmp_p-10: lstr10.casecmp?(ustr10)
+  casecmp_p-100: lstr100.casecmp?(ustr100)
+  casecmp_p-1000: lstr1000.casecmp?(ustr1000)
+  casecmp_p-nonascii1: lnonascii1.casecmp?(unonascii1)
+  casecmp_p-nonascii10: lnonascii10.casecmp?(unonascii10)
+  casecmp_p-nonascii100: lnonascii100.casecmp?(unonascii100)
+  casecmp_p-nonascii1000: lnonascii1000.casecmp?(unonascii1000)
diff --git a/benchmark/string_downcase.yml b/benchmark/string_downcase.yml
index a31c3ac..1fea6af 100644
--- a/benchmark/string_downcase.yml
+++ b/benchmark/string_downcase.yml
@@ -3,8 +3,16 @@ prelude: | https://github.com/ruby/ruby/blob/trunk/benchmark/string_downcase.yml#L3
   str10 = str1 * 10
   str100 = str10 * 10
   str1000 = str100 * 10
+  nonascii1 = [*"\u{c0}".."\u{df}"].join("")
+  nonascii10 = nonascii1 * 10
+  nonascii100 = nonascii10 * 10
+  nonascii1000 = nonascii100 * 10
 benchmark:
   downcase-1: str1.upcase
   downcase-10: str10.upcase
   downcase-100: str100.upcase
   downcase-1000: str1000.upcase
+  downcase-nonascii1: nonascii1.downcase
+  downcase-nonascii10: nonascii10.downcase
+  downcase-nonascii100: nonascii100.downcase
+  downcase-nonascii1000: nonascii1000.downcase
diff --git a/benchmark/string_swapcase.yml b/benchmark/string_swapcase.yml
index afaae3f..eeb5928 100644
--- a/benchmark/string_swapcase.yml
+++ b/benchmark/string_swapcase.yml
@@ -3,8 +3,16 @@ prelude: | https://github.com/ruby/ruby/blob/trunk/benchmark/string_swapcase.yml#L3
   str10 = str1 * 10
   str100 = str10 * 10
   str1000 = str100 * 10
+  nonascii1 = [*"\u{c0}".."\u{cf}",*"\u{f0}".."\u{ff}"].join("")
+  nonascii10 = nonascii1 * 10
+  nonascii100 = nonascii10 * 10
+  nonascii1000 = nonascii100 * 10
 benchmark:
   swapcase-1: str1.swapcase
   swapcase-10: str10.swapcase
   swapcase-100: str100.swapcase
   swapcase-1000: str1000.swapcase
+  swapcase-nonascii1: nonascii1.swapcase
+  swapcase-nonascii10: nonascii10.swapcase
+  swapcase-nonascii100: nonascii100.swapcase
+  swapcase-nonascii1000: nonascii1000.swapcase
diff --git a/benchmark/string_upcase.yml b/benchmark/string_upcase.yml
index 456d213..dab84bb 100644
--- a/benchmark/string_upcase.yml
+++ b/benchmark/string_upcase.yml
@@ -3,8 +3,16 @@ prelude: | https://github.com/ruby/ruby/blob/trunk/benchmark/string_upcase.yml#L3
   str10 = str1 * 10
   str100 = str10 * 10
   str1000 = str100 * 10
+  nonascii1 = [*"\u{e0}".."\u{ff}"].join("")
+  nonascii10 = nonascii1 * 10
+  nonascii100 = nonascii10 * 10
+  nonascii1000 = nonascii100 * 10
 benchmark:
   upcase-1: str1.upcase
   upcase-10: str10.upcase
   upcase-100: str100.upcase
   upcase-1000: str1000.upcase
+  upcase-nonascii1: nonascii1.upcase
+  upcase-nonascii10: nonascii10.upcase
+  upcase-nonascii100: nonascii100.upcase
+  upcase-nonascii1000: nonascii1000.upcase
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]