@@ -183,9 +183,28 @@ def benchmark_categories(name)
183183
184184# Check if the name matches any of the names in a list of filters
185185def match_filter ( entry , categories :, name_filters :)
186+ name_filters = process_name_filters ( name_filters )
186187 name = entry . sub ( /\. rb\z / , '' )
187188 ( categories . empty? || benchmark_categories ( name ) . any? { |cat | categories . include? ( cat ) } ) &&
188- ( name_filters . empty? || name_filters . include? ( name ) )
189+ ( name_filters . empty? || name_filters . any? { |filter | filter === name } )
190+ end
191+
192+ # process "/my_benchmark/i" into /my_benchmark/i
193+ def process_name_filters ( name_filters )
194+ name_filters . map do |name_filter |
195+ if name_filter [ 0 ] == "/"
196+ regexp_str = name_filter [ 1 ..-1 ] . reverse . sub ( /\A (\w *)\/ / , "" )
197+ regexp_opts = $1. to_s
198+ regexp_str . reverse!
199+ r = /#{ regexp_str } /
200+ if !regexp_opts . empty?
201+ r = Regexp . compile ( r . to_s , regexp_opts )
202+ end
203+ r
204+ else
205+ name_filter
206+ end
207+ end
189208end
190209
191210# Resolve the pre_init file path into a form that can be required
@@ -341,6 +360,7 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
341360 graph : false ,
342361 no_pinning : false ,
343362 turbo : false ,
363+ skip_yjit : false ,
344364} )
345365
346366OptionParser . new do |opts |
@@ -381,23 +401,27 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
381401
382402 opts . on ( "--category=headline,other,micro,ractor" , "when given, only benchmarks with specified categories will run" ) do |v |
383403 args . categories += v . split ( "," )
384- if args . categories == [ ' ractor' ]
385- args . harness = ' harness-ractor'
404+ if args . categories == [ " ractor" ]
405+ args . harness = " harness-ractor"
386406 end
387407 end
388408
389- opts . on ( "--headline" , "when given, headline benchmarks will be run" ) do | v |
409+ opts . on ( "--headline" , "when given, headline benchmarks will be run" ) do
390410 args . categories += [ "headline" ]
391411 end
392412
393- opts . on ( "--ractor-only" , "ractor-only benchmarks (benchmarks/ractor/*.rb) will be run" ) do | v |
413+ opts . on ( "--ractor-only" , "ractor-only benchmarks (benchmarks/ractor/*.rb) will be run" ) do
394414 args . categories = [ "ractor-only" ]
395415 end
396416
397417 opts . on ( "--name_filters=x,y,z" , Array , "when given, only benchmarks with names that contain one of these strings will run" ) do |list |
398418 args . name_filters = list
399419 end
400420
421+ opts . on ( "--skip-yjit" , "Don't run with yjit after interpreter" ) do
422+ args . skip_yjit = true
423+ end
424+
401425 opts . on ( "--harness=HARNESS_DIR" , "which harness to use" ) do |v |
402426 v = "harness-#{ v } " unless v . start_with? ( 'harness' )
403427 args . harness = v
@@ -459,7 +483,7 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
459483
460484# If -e is not specified, benchmark the current Ruby. Compare it with YJIT if available.
461485if args . executables . empty?
462- if have_yjit? ( RbConfig . ruby )
486+ if have_yjit? ( RbConfig . ruby ) && ! args . skip_yjit
463487 args . executables [ "interp" ] = [ RbConfig . ruby ]
464488 args . executables [ "yjit" ] = [ RbConfig . ruby , "--yjit" , *args . yjit_opts . shellsplit ]
465489 else
0 commit comments