summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2024-08-31 18:48:57 +0900
committernagachika <nagachika@ruby-lang.org>2024-08-31 18:48:57 +0900
commit7c2cdca7f250d0b270df585f69f275f72c415348 (patch)
tree6c68fe33dec946b798d640a0c5125fb7ef848674
parent07d7ffeb9c2c6537883a1ea7b180eb04ecbe47e6 (diff)
merge revision(s) f9eb2515a3221cced611b4de971b72a78a7a566f:
core_assertions.rb: Extract common code block
-rw-r--r--tool/lib/core_assertions.rb17
-rw-r--r--version.h2
2 files changed, 10 insertions, 9 deletions
diff --git a/tool/lib/core_assertions.rb b/tool/lib/core_assertions.rb
index 6000d39c90..81faac1e4b 100644
--- a/tool/lib/core_assertions.rb
+++ b/tool/lib/core_assertions.rb
@@ -746,15 +746,18 @@ eom
def assert_linear_performance(seq, rehearsal: nil, pre: ->(n) {n})
# Timeout testing generally doesn't work when RJIT compilation happens.
rjit_enabled = defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled?
+ measure = proc do |arg, message|
+ st = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ yield(*arg)
+ t = (Process.clock_gettime(Process::CLOCK_MONOTONIC) - st)
+ assert_operator 0, :<=, t, message unless rjit_enabled
+ t
+ end
first = seq.first
*arg = pre.call(first)
times = (0..(rehearsal || (2 * first))).map do
- st = Process.clock_gettime(Process::CLOCK_MONOTONIC)
- yield(*arg)
- t = (Process.clock_gettime(Process::CLOCK_MONOTONIC) - st)
- assert_operator 0, :<=, t unless rjit_enabled
- t.nonzero?
+ measure[arg, "rehearsal"].nonzero?
end
times.compact!
tmin, tmax = times.minmax
@@ -767,9 +770,7 @@ eom
*arg = pre.call(i)
message = "[#{i}]: in #{t}s #{info}"
Timeout.timeout(t, Timeout::Error, message) do
- st = Process.clock_gettime(Process::CLOCK_MONOTONIC)
- yield(*arg)
- assert_operator (Process.clock_gettime(Process::CLOCK_MONOTONIC) - st), :<=, t, message unless rjit_enabled
+ measure[arg, message]
end
end
end
diff --git a/version.h b/version.h
index adc0db9b2d..6a5a3d4be0 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 5
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 216
+#define RUBY_PATCHLEVEL 217
#include "ruby/version.h"
#include "ruby/internal/abi.h"