diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-06-09 16:10:30 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-06-09 20:22:30 +0900 |
commit | ab6eb3786c94e69c561080cbb796c2381702a3a4 (patch) | |
tree | 2fe551edd62566939a7760439851fd7ad90b2d13 /benchmark | |
parent | d54f66d1b4ce32d78b526b1ea9e3f213a763d07c (diff) |
Optimize `Regexp#dup` and `Regexp.new(/RE/)`
When copying from another regexp, copy already built `regex_t` instead
of re-compiling its source.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7922
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/regexp_dup.yml | 6 | ||||
-rw-r--r-- | benchmark/regexp_new.yml | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/benchmark/regexp_dup.yml b/benchmark/regexp_dup.yml new file mode 100644 index 0000000000..52f89991cd --- /dev/null +++ b/benchmark/regexp_dup.yml @@ -0,0 +1,6 @@ +prelude: | + str = "a" * 1000 + re = Regexp.new(str) + +benchmark: + dup: re.dup diff --git a/benchmark/regexp_new.yml b/benchmark/regexp_new.yml new file mode 100644 index 0000000000..bc9ab3ca21 --- /dev/null +++ b/benchmark/regexp_new.yml @@ -0,0 +1,7 @@ +prelude: | + str = "a" * 1000 + re = Regexp.new(str) + +benchmark: + string: Regexp.new(str) + regexp: Regexp.new(re) |