[#75687] [Ruby trunk Bug#12416] struct rb_id_table lacks mark function — shyouhei@...
Issue #12416 has been reported by Shyouhei Urabe.
3 messages
2016/05/23
[#75763] [Ruby trunk Feature#12435] Using connect_nonblock to open TCP connections in Net::HTTP#connect — mohamed.m.m.hafez@...
Issue #12435 has been reported by Mohamed Hafez.
3 messages
2016/05/28
[#75774] Errno::EAGAIN thrown by OpenSSL::SSL::SSLSocket#connect_nonblock — Mohamed Hafez <mohamed.m.m.hafez@...>
Hi all, every now and then in my production server, I'm
4 messages
2016/05/30
[#75775] Re: Errno::EAGAIN thrown by OpenSSL::SSL::SSLSocket#connect_nonblock
— Mohamed Hafez <mohamed.m.m.hafez@...>
2016/05/30
Or does MRI's OpenSSL::SSL::SSLSocket#connect_nonblock just return
[#75782] Important: Somewhat backwards-incompatible change (Fwd: [ruby-cvs:62388] duerst:r55225 (trunk): * string.c: Activate full Unicode case mapping for UTF-8) — Martin J. Dürst <duerst@...>
With the change below, I have activated full Unicode case mapping for
4 messages
2016/05/31
[ruby-core:75462] [Ruby trunk Bug#12373] Optimize CSV#shift
From:
co000ri@...
Date:
2016-05-12 00:45:12 UTC
List:
ruby-core #75462
Issue #12373 has been reported by Yuki Kurihara.
----------------------------------------
Bug #12373: Optimize CSV#shift
https://bugs.ruby-lang.org/issues/12373
* Author: Yuki Kurihara
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.4.0dev (2016-05-11 trunk 54976) [x86_64-darwin15]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
I think that **str1.start_with?(str2)** is faster than **str1[0] == str2**.
Because **str1.start_with?(str2)** just call **String#start_with?**, But **str1[0] == str2** make string object, call **String#[]** and call **String#==**.
(The patch is csv-shift.patch)
Benchmark results.
csv-benchmark.rb make temp CSV file and call **CSV#each** method(inner call **CSV#shift**)
~~~
$ ruby csv-benchmark.rb
Warming up --------------------------------------
old_csv_shift 1.000 i/100ms
new_csv_shift 1.000 i/100ms
Calculating -------------------------------------
old_csv_shift 0.444 (賊 0.0%) i/s - 3.000 in 6.759200s
new_csv_shift 0.479 (賊 0.0%) i/s - 3.000 in 6.264069s
Comparison:
new_csv_shift: 0.5 i/s
old_csv_shift: 0.4 i/s - 1.08x slower
~~~
string-start_with.rb is a micro benchmark for **str1[0] == str2** and **str1.start_with?(str2)**
~~~
$ ruby string-start_with.rb
Warming up --------------------------------------
a[0] == b 90.881k i/100ms
a.start_with?(b) 115.557k i/100ms
Calculating -------------------------------------
a[0] == b 1.836M (賊 3.8%) i/s - 9.179M in 5.006568s
a.start_with?(b) 3.183M (賊 4.2%) i/s - 15.947M in 5.018654s
Comparison:
a.start_with?(b): 3183386.0 i/s
a[0] == b: 1836263.5 i/s - 1.73x slower
~~~
Of course $ make test-all TESTS="test/csv/*" passed
---Files--------------------------------
csv-benchmark.rb (561 Bytes)
old_csv_shift.rb (5.1 KB)
new_csv_shift.rb (5.11 KB)
string-start_with.rb (215 Bytes)
csv-shift.patch (434 Bytes)
--
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>