[#27003] [Bug #2422] splat operator fails on array of 1 element — Raul Parolari <redmine@...>

Bug #2422: splat operator fails on array of 1 element

12 messages 2009/12/02

[#27025] [Backport #2431] StringIO#{gets,readlines} with "" (paragraph mode) trims last "\n" — Hiroshi NAKAMURA <redmine@...>

Backport #2431: StringIO#{gets,readlines} with "" (paragraph mode) trims last "\n"

8 messages 2009/12/04

[#27086] [Feature #2454] OpenSSL has no maintainer — Yui NARUSE <redmine@...>

Feature #2454: OpenSSL has no maintainer

16 messages 2009/12/07

[#27120] #to_enum ignores block? — Roger Pack <rogerdpack@...>

Is #to_enum ignoring its block expected?

11 messages 2009/12/09

[#27135] better GC? — Roger Pack <rogerdpack@...>

Could I put in a small plea for a better GC?

56 messages 2009/12/10
[#27136] Re: better GC? — Yukihiro Matsumoto <matz@...> 2009/12/11

Hi,

[#27476] Re: better GC? — Paul Brannan <pbrannan@...> 2010/01/07

On Fri, Dec 11, 2009 at 09:07:16AM +0900, Yukihiro Matsumoto wrote:

[#27477] Re: better GC? — Eero Saynatkari <ruby-ml@...> 2010/01/07

Excerpts from Paul Brannan's message of Thu Jan 07 21:53:34 +0200 2010:

[#27563] Re: better GC? — Brent Roman <brent@...> 2010/01/12

[#27199] [Backport #2488] thread usage can result in bad HANDLE — Roger Pack <redmine@...>

Backport #2488: thread usage can result in bad HANDLE

12 messages 2009/12/16

[#27286] [Bug #2515] Array#select! — Roger Pack <redmine@...>

Bug #2515: Array#select!

17 messages 2009/12/22

[#27327] [Bug #2531] Ruby 1.8.7-p248 fails to cross-compile same version — Luis Lavena <redmine@...>

Bug #2531: Ruby 1.8.7-p248 fails to cross-compile same version

9 messages 2009/12/25

[#27360] [Feature #2542] URI lib should be updated to RFC 39886 — Marc-Andre Lafortune <redmine@...>

Feature #2542: URI lib should be updated to RFC 39886

15 messages 2009/12/31

[ruby-core:27214] Re: [PATCH] fix CGI::escape to work with blocks, avoid dollar variables

From: "NARUSE, Yui" <naruse@...>
Date: 2009-12-18 15:19:27 UTC
List: ruby-core #27214
(2009/12/18 10:00), Gaston Ramos wrote:
> El Thu, 17 de Dec de 2009, a las 09:53:37PM +0900, NARUSE, Yui dijo:
>>
>> I mean, your stating point: allow overriding String#gsub.
>> Even if you fix cgi.rb, other problem will happen.
> What other problem ? can you give me an example? I give you an example 
> that show you when the current version of cgi has problems.
> Did you read this ticket? is other case when the current cgi doesn't  work
> and the problem is related with dollar variable.

An example is following:

class String
  alias :old_gsub :gsub
    def gsub(*args, &block)
       old_gsub(*args, &block)
    end
end

"abc".gsub(/b/){$'=='c' ? 'X' : $'=='C' ? 'Y' : 'Z'}
#=> "aZc"
"AbC".gsub(/b/){$'=='c' ? 'X' : $'=='C' ? 'Y' : 'Z'}
#=> "AZC"

> Or simply use my patch under Ruby 1.9 with String#gsub redefined.

Following, cgi/util is current and ./lib/cgi/util is my patch.

ruby19 -rcgi/util -e'CGI.escape("abc\u3042\u3044\u3046"*500000)'  13.24s user 0.29s system 99% cpu 13.542 total
ruby19 -r./lib/cgi/util -e'CGI.escape("abc\u3042\u3044\u3046"*500000)'  8.73s user 0.26s system 99% cpu 8.995 total


ruby19 -rcgi/util -e'CGI.escape("\u3042\u3044\u3046"*500000)'  7.02s user 3.43s system 99% cpu 10.468 total
ruby19 -r./lib/cgi/util -e'CGI.escape("\u3042\u3044\u3046"*500000)'  8.48s user 0.20s system 99% cpu 8.682 total


ruby19 -rcgi/util -e'CGI.escape("abc"*500000)'  0.33s user 0.04s system 99% cpu 0.367 total
ruby19 -r./lib/cgi/util -e'CGI.escape("abc"*500000)'  0.23s user 0.04s system 99% cpu 0.266 total

ruby19 -rcgi/util -e'100000.times{CGI.escape("abc\u3042\u3044\u3046def")}'  4.38s user 0.04s system 99% cpu 4.415 total
ruby19 -r./lib/cgi/util   3.46s user 0.02s system 99% cpu 3.489 total


ruby19 -rcgi/util -e's="%E3%81%82"*500000;CGI.unescape(s)'  2.51s user 4.92s system 98% cpu 7.560 total
ruby19 -r./lib/cgi/util.rb -e's="%E3%81%82"*500000;CGI.unescape(s)'  3.61s user 0.07s system 99% cpu 3.681 total


ruby19 -rcgi/util -e's="abc%E3%81%82"*500000;CGI.unescape(s)'  9.17s user 0.10s system 99% cpu 9.310 total
ruby19 -r./lib/cgi/util.rb -e's="abc%E3%81%82"*500000;CGI.unescape(s)'  3.84s user 0.09s system 99% cpu 3.932 total

ruby19 -rcgi/util -e's="abc"*500000;CGI.unescape(s)'  0.12s user 0.03s system 98% cpu 0.156 total
ruby19 -r./lib/cgi/util.rb -e's="abc"*500000;CGI.unescape(s)'  0.11s user 0.03s system 98% cpu 0.140 total

-- 
NARUSE, Yui  <naruse@airemix.jp>

In This Thread

Prev Next