From: benny Date: 2005-02-08T03:10:09+09:00 Subject: Re: Performance of CGI::Cookie / SimpleDelegator fix just saw this thread on google http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/117475 apparently this fix didn't make it into ruby 1.8.2: ruby --version ruby 1.8.2 (2004-12-25) [i386-freebsd5] benny benny wrote: > dear list > > just discovered that the CGI::Cookie class has a major impact on > performance. > > When using it, ab gives me (using fcgi/apache 1.3) > > 40.85 Requests / second > > when simplifying the initialization of CGI::Cookie (see below), its 3 > times faster: > > 124.64 Requests / second > > Perhaps someone should dig in this. It seems to be related to the > SimpleDelegator superclassing (though I don't see why delegating should be > necessary here, the simplification seems to work fine). > > benny > > -- > > class CGI > class Cookie > def initialize(options) > unless options.has_key?("name") > raise ArgumentError, "`name' required" > end > > @name = options["name"] > @value = Array(options["value"]) > > # simple support for IE > if options["path"] > @path = options["path"] > else > %r|^(.*/)|.match(ENV["SCRIPT_NAME"]) > @path = ($1 or "") > end > > @domain = options["domain"] > @expires = options["expires"] > @secure = options["secure"] == true ? true : false > end > end > end > > -- --------------------------------------------------------------------------------------------------- Don't crash when a filter changes the subject of a message which results in the attempt to remove it from the tree of subject threading messages failing and the detached child looking for a new parent finding the old parent as the new parent, which in turn results in the child being deleted with the old (and new) parent, which is not a good idea, since it is still referenced. (Till Adams commit on kdepim/kmail/kmheaders.cpp in HEAD, 6. Jan. 2005)