[#15359] Timeout::Error — Jeremy Thurgood <jerith@...>

Good day,

41 messages 2008/02/05
[#15366] Re: Timeout::Error — Eric Hodel <drbrain@...7.net> 2008/02/06

On Feb 5, 2008, at 06:20 AM, Jeremy Thurgood wrote:

[#15370] Re: Timeout::Error — Jeremy Thurgood <jerith@...> 2008/02/06

Eric Hodel wrote:

[#15373] Re: Timeout::Error — Nobuyoshi Nakada <nobu@...> 2008/02/06

Hi,

[#15374] Re: Timeout::Error — Jeremy Thurgood <jerith@...> 2008/02/06

Nobuyoshi Nakada wrote:

[#15412] Re: Timeout::Error — Nobuyoshi Nakada <nobu@...> 2008/02/07

Hi,

[#15413] Re: Timeout::Error — Jeremy Thurgood <jerith@...> 2008/02/07

Nobuyoshi Nakada wrote:

[#15414] Re: Timeout::Error — Nobuyoshi Nakada <nobu@...> 2008/02/07

Hi,

[#15360] reopen: can't change access mode from "w+" to "w"? — Sam Ruby <rubys@...>

I ran 'rake test' on test/spec [1], using

16 messages 2008/02/05
[#15369] Re: reopen: can't change access mode from "w+" to "w"? — Nobuyoshi Nakada <nobu@...> 2008/02/06

Hi,

[#15389] STDIN encoding differs from default source file encoding — Dave Thomas <dave@...>

This seems strange:

21 messages 2008/02/06
[#15392] Re: STDIN encoding differs from default source file encoding — Yukihiro Matsumoto <matz@...> 2008/02/06

Hi,

[#15481] very bad character performance on ruby1.9 — "Eric Mahurin" <eric.mahurin@...>

I'd like to bring up the issue of how characters are represented in

16 messages 2008/02/10

[#15528] Test::Unit maintainer — Kouhei Sutou <kou@...>

Hi Nathaniel, Ryan,

22 messages 2008/02/13

[#15551] Proc#curry — ts <decoux@...>

21 messages 2008/02/14
[#15557] Re: [1.9] Proc#curry — David Flanagan <david@...> 2008/02/15

ts wrote:

[#15558] Re: [1.9] Proc#curry — Yukihiro Matsumoto <matz@...> 2008/02/15

Hi,

[#15560] Re: Proc#curry — Trans <transfire@...> 2008/02/15

[#15585] Ruby M17N meeting summary — Martin Duerst <duerst@...>

This is a rough translation of the Japanese meeting summary

19 messages 2008/02/18

[#15596] possible bug in regexp lexing — Ryan Davis <ryand-ruby@...>

current:

17 messages 2008/02/19

[#15678] Re: [ANN] MacRuby — "Rick DeNatale" <rick.denatale@...>

On 2/27/08, Laurent Sansonetti <laurent.sansonetti@gmail.com> wrote:

18 messages 2008/02/28
[#15679] Re: [ANN] MacRuby — "Laurent Sansonetti" <laurent.sansonetti@...> 2008/02/28

On Thu, Feb 28, 2008 at 6:33 AM, Rick DeNatale <rick.denatale@gmail.com> wrote:

[#15680] Re: [ANN] MacRuby — Yukihiro Matsumoto <matz@...> 2008/02/28

Hi,

[#15683] Re: [ANN] MacRuby — "Laurent Sansonetti" <laurent.sansonetti@...> 2008/02/28

On Thu, Feb 28, 2008 at 1:51 PM, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:

Re: very bad character performance on ruby1.9

From: "=?ISO-8859-2?Q?Rados=B3aw_Bu=B3at?=" <radek.bulat@...>
Date: 2008-02-11 20:41:21 UTC
List: ruby-core #15508
I have something similar to this problem.

#========
require "benchmark"

def longest_repeated_substring(s)
  found = nil
  1.upto(s.size / 2) do |n|
    (s.size - n).times do |i|
      sub = s.slice(i, n)
      if s.index(sub, i + n) # > marks[i] ? i + n : marks[i])
        found = sub
        break
      end
    end
    if found.nil? || found.size < n
      break
    end
  end
  return found
end

system("wget http://www.gnu.org/licenses/gpl-2.0.txt") unless
File.exists?("gpl-2.0.txt")

Benchmark.bmbm do |make|
  make.report do
    longest_repeated_substring(ARGV[0] || File.read("gpl-2.0.txt"))
  end
end

#=======end

Benchmarks shows that running it on ruby1.9 is about 15x slower that ruby1.8.
There is outputs (I removed ) from profiling it (-rprofile):

#ruby1.8
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 56.50     3.00      3.00      120    25.00    44.00  Integer#times
 29.38     4.56      1.56    42250     0.04     0.04  String#index
  7.72     4.97      0.41    42250     0.01     0.01  String#slice
  5.84     5.28      0.31    42252     0.01     0.01  Fixnum#+
  0.38     5.30      0.02        2    10.00  2650.00  Integer#upto
  0.19     5.31      0.01       21     0.48     0.48  String#gsub!

#ruby1.9
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
  0.13     0.06      0.03      242     0.12     0.12  String#size
  1.05     0.30      0.24    42252     0.01     0.01  Fixnum#+
  5.71     1.61      1.31        2   655.00 10375.00  Integer#times
 43.79    11.65     10.04    42250     0.24     0.24  String#slice
 48.76    22.83     11.18    42250     0.26     0.26  String#index

It looks like the problem is in String#slice and String#index methods.

-- 
Rados梶w Buウat

http://radarek.jogger.pl - m blog

In This Thread