[#86520] [Ruby trunk Bug#14681] `syswrite': stream closed in another thread (IOError) — samuel@...
Issue #14681 has been reported by ioquatix (Samuel Williams).
3 messages
2018/04/12
[#86755] [Ruby trunk Feature#14723] [WIP] sleepy GC — normalperson@...
Issue #14723 has been reported by normalperson (Eric Wong).
6 messages
2018/04/29
[ruby-core:86571] [Ruby trunk Bug#14695] [2.5.1] `===` is 1.77x slower than `match?`
From:
keystonelemur@...
Date:
2018-04-18 07:30:40 UTC
List:
ruby-core #86571
Issue #14695 has been reported by baweaver (Brandon Weaver).
----------------------------------------
Bug #14695: [2.5.1] `===` is 1.77x slower than `match?`
https://bugs.ruby-lang.org/issues/14695
* Author: baweaver (Brandon Weaver)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Was evaluating some of the `===` implementations while testing and came across this one:
~~~ ruby
# ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
require 'benchmark/ips'
def run_benchmark(title, **benchmarks)
puts '', title, '=' * title.size, ''
# Validation
benchmarks.each do |benchmark_name, benchmark_fn|
puts "#{benchmark_name} result: #{benchmark_fn.call()}"
end
puts
Benchmark.ips do |bm|
benchmarks.each do |benchmark_name, benchmark_fn|
bm.report(benchmark_name, &benchmark_fn)
end
bm.compare!
end
end
regex = /foo/
# => /foo/
string = 'foobarbaz'
# => "foobarbaz"
run_benchmark('=== vs match? - 2.5.1',
'===': -> { regex === string },
'match?': -> { regex.match? string }
)
=== vs match? - 2.5.1
=====================
=== result: true
match? result: true
Warming up --------------------------------------
=== 173.435k i/100ms
match? 233.124k i/100ms
Calculating -------------------------------------
=== 3.174M (賊 1.6%) i/s - 15.956M in 5.029027s
match? 5.626M (賊 2.5%) i/s - 28.208M in 5.016991s
Comparison:
match?: 5626170.1 i/s
===: 3173659.6 i/s - 1.77x slower
~~~
It appears that `===` is running a bit slower than `match?`, though there may be some concerns around old code potentially relying on regex set globals after `===` too in case statements, so not sure there.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>