[#28687] [Bug #2973] rb_bug - Segmentation fault - error.c:213 — rudolf gavlas <redmine@...>

Bug #2973: rb_bug - Segmentation fault - error.c:213

10 messages 2010/03/16

[#28735] [Bug #2982] Ruby tries to link with both openssl and readline — Lucas Nussbaum <redmine@...>

Bug #2982: Ruby tries to link with both openssl and readline

16 messages 2010/03/18

[#28736] [Bug #2983] Ruby (GPLv2 only) tries to link to with readline (now GPLv3) — Lucas Nussbaum <redmine@...>

Bug #2983: Ruby (GPLv2 only) tries to link to with readline (now GPLv3)

10 messages 2010/03/18

[#28907] [Bug #3000] Open SSL Segfaults — Christian Höltje <redmine@...>

Bug #3000: Open SSL Segfaults

19 messages 2010/03/23

[#28924] [Bug #3005] Ruby core dump - [BUG] rb_sys_fail() - errno == 0 — Sebastian YEPES <redmine@...>

Bug #3005: Ruby core dump - [BUG] rb_sys_fail() - errno == 0

10 messages 2010/03/24

[#28954] [Feature #3010] slow require gems in ruby 1.9.1 — Miao Jiang <redmine@...>

Feature #3010: slow require gems in ruby 1.9.1

15 messages 2010/03/24

[#29179] [Bug #3071] Convert rubygems and rdoc to use psych — Aaron Patterson <redmine@...>

Bug #3071: Convert rubygems and rdoc to use psych

10 messages 2010/03/31

[ruby-core:28490] Re: [Feature #905] Add String.new(fixnum) to preallocate large buffer

From: Kornelius Kalnbach <murphy@...>
Date: 2010-03-04 21:08:51 UTC
List: ruby-core #28490
On 04.03.10 21:08, caleb clausen wrote:
> If String#<< is really O(1), there would seem to be little reason to
> change anything. I still want to investigate this myself when I get a
> chance.
O(n), where n is the size of the appended string.

But I think it's always worth to look into speedups even if we can't
expect to change the complexity class. The O-factor may not interesting
to theorists, but it matters greatly to programmers. JRuby, for example,
concats strings almost twice as fast in this benchmark:

require 'benchmark'

N = 10_000_000
Benchmark.bm 20 do |results|
  results.report 'loop' do
    N.times { }
  end
  results.report "'' <<" do
    s = ''
    N.times { s << '.' << 'word' }
  end
end

ruby19 string_buffer.rb
                          user     system      total        real
loop                  1.240000   0.010000   1.250000 (  1.255154)
'' <<                 5.820000   0.060000   5.880000 (  5.889959)

jruby string_buffer.rb
                          user     system      total        real
loop                  0.584000   0.000000   0.584000 (  0.488000)
'' <<                 2.900000   0.000000   2.900000 (  2.900000)

So, there is room for optimization somewhere.

[murphy]

In This Thread