-
- Downloads
Optimization: avoid repeated interpolation in regexp
Benchmark.bm do |b| b.report("before") do 100_000.times { /(\.#{MacOS.cat}\.bottle\.(\d+\.)?tar\.gz)$/ } end b.report("after ") do 100_000.times { /(\.#{MacOS.cat}\.bottle\.(\d+\.)?tar\.gz)$/o } end end user system total real before 35.400000 0.140000 35.540000 ( 35.619674) after 0.020000 0.000000 0.020000 ( 0.016662)
Please register or sign in to comment