diff options
| author | Jack Nagel | 2013-04-14 18:20:09 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-04-14 18:32:48 -0500 |
| commit | 3c73cc28e0bf12d54f344135b35c5af8feaf0a77 (patch) | |
| tree | 9f32c2cb1f92eed484b7537bf416639fcf1c8aac /Library | |
| parent | 2e58fbf2602b246061df68031d8ee3d1649fc09c (diff) | |
| download | brew-3c73cc28e0bf12d54f344135b35c5af8feaf0a77.tar.bz2 | |
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)
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/bottles.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb index 32b6f8471..159654c48 100644 --- a/Library/Homebrew/bottles.rb +++ b/Library/Homebrew/bottles.rb @@ -63,7 +63,7 @@ def bottle_suffix revision=nil end def bottle_native_regex - /(\.#{MacOS.cat}\.bottle\.(\d+\.)?tar\.gz)$/ + /(\.#{MacOS.cat}\.bottle\.(\d+\.)?tar\.gz)$/o end def bottle_regex |
