yarv-dev:974
From: sheepman <sheepman sheepman.sakura.ne.jp>
Date: Thu, 23 Feb 2006 22:27:16 +0900
Subject: [yarv-dev:974] Re: open> SizedQueue is too slow
こんばんは、sheepman です。 On Thu, 23 Feb 2006 22:15:13 +0900 sheepman <sheepman sheepman.sakura.ne.jp> wrote: > こんばんは、sheepman です。 > 僕の手元の環境だけかも知れませんが、以下のようなスクリプトを > 走らせるとruby-1.9に比べて異常に遅いので調べてみました。 > 良く見ると、Queue#pop のraiseの位置もおかしいですね。 $ diff -U 4 thread.rb\~ thread.rb --- thread.rb~ 2006-02-23 21:51:50.000000000 +0900 +++ thread.rb 2006-02-23 22:22:10.000000000 +0900 @@ -175,19 +175,19 @@ # suspended until data is pushed onto the queue. If +non_block+ is true, the # thread isn't suspended, and an exception is raised. # def pop(non_block=false) - raise ThreadError, "queue empty" if non_block while true @mutex.synchronize{ if @que.empty? + raise ThreadError, "queue empty" if non_block @waiting.push Thread.current - @mutex.unlock_and_stop - @mutex.lock + break else return @que.shift end } + Thread.pass end end # -- sheepman / TAMURA Takashi sheepman sheepman.sakura.ne.jp http://sheepman.parfait.ne.jp/ -- ML: yarv-dev quickml.atdot.net 使い方: http://www.atdot.net/~ko1/quickml
973 2006-02-23 22:15 [sheepman sheepman.sa] open> SizedQueue is too slow -> 974 2006-02-23 22:27 ┗[sheepman sheepman.sa] 975 2006-02-23 23:26 ┗[sheepman sheepman.sa] 983 2006-02-27 11:42 ┗[aamine loveruby.net ] fixed> Re: SizedQueue is too slow 984 2006-02-27 15:21 ┣[matz ruby-lang.org ] 990 2006-02-27 22:07 ┗[sheepman sheepman.sa] 991 2006-02-27 22:09 ┣[ko1 atdot.net ] 993 2006-02-27 22:41 ┗[aamine loveruby.net ] Re: SizedQueue is too slow