[#37892] 配列の重複検出用Hashの使いまわし — wanabe <s.wanabe@...>
ワナベと申します。
[#37898] [Bug #1105] Ruby1.9でのrescue節の例外ハンドラのマッチの処理 — Tatsuji Kawai <redmine@...>
Bug #1105: Ruby1.9でのrescue節の例外ハンドラのマッチの処理
[#37910] [Bug:1.9] lack consistency in hash iteration — Yusuke ENDOH <mame@...>
遠藤です。
まつもと ゆきひろです
[#37918] [BUG: 1.9] encoding warning — SASADA Koichi <ko1@...>
ささだです.
[#37921] [Feature:trunk] with_index_from — Yusuke ENDOH <mame@...>
遠藤です。
At Thu, 5 Feb 2009 23:18:49 +0900,
遠藤です。
At Fri, 6 Feb 2009 00:58:59 +0900,
[#37936] zombie processes by drb tests — Tanaka Akira <akr@...>
OpenBSD で、test-all をすると、drb のところで、テストに 100
咳といいます。
[#37956] proposal: Module#method_adding — SASADA Koichi <ko1@...>
ささだです.
[#37959] [Bug:trunk] I can modify literals — Yusuke ENDOH <mame@...>
遠藤です。
[#37980] Re: [ruby-changes:10687] Ruby:r22250 (trunk): * iseq.c (simple_default_value): allow plain strings as default — SASADA Koichi <ko1@...>
ささだです.
[#37995] Add POSTARG support to rb_scan_args() — Akinori MUSHA <akinori.musha@...>
rb_scan_args()をPOSTARG対応にするパッチです。
[#37998] [Feature:1.9] {Array,Enumerable}#uniq_by, #uniq_by! — Nobuyoshi Nakada <nobu@...>
なかだです。
[#38005] Is URI.decode() broken? — MOROHASHI Kyosuke <moronatural@...>
もろはしです。いつもお世話になっております。
なかだです。
成瀬です、
xibbarこと藤岡です。
成瀬です。
NARUSE, Yui さんは書きました:
成瀬です。
(2009年03月03日 22:45), NARUSE, Yui さんは書きました:
成瀬です。
In article <4A9E44DD.6050706@airemix.jp>,
成瀬です。
小崎@思いつきを適当に書いてみるテスト
In article <20090907091830.2C7A.A69D9226@jp.fujitsu.com>,
> In article <20090907091830.2C7A.A69D9226@jp.fujitsu.com>,
2009/09/07 14:38, Tanaka Akira wrote:
In article <4AA5EA67.1040504@airemix.jp>,
[#38007] [Feature #1159] StringScanner に文字ベースでのインデックスを返すメソッドがほしい — Akira Matsuda <redmine@...>
Feature #1159: StringScanner に文字ベースでのインデックスを返すメソッドがほしい
[#38018] circular require in openssl — Tanaka Akira <akr@...>
以下のように、openssl には環状の require があり、警告が出ます。
In article <87vdrcul7y.fsf@fsij.org>,
まつもと ゆきひろです
In article <E1LYyoE-0005P0-Hi@x61.netlab.jp>,
[#38022] ENCODING_FIXED と ENCODING_NONE の廃止 — "NARUSE, Yui" <naruse@...>
成瀬です。
In article <49986A0A.5060602@airemix.jp>,
成瀬です。
In article <49995412.6040000@airemix.jp>,
[#38048] Add option hash support to rb_scan_args() — "Akinori MUSHA" <knu@...>
rb_scan_args() にoption hash対応を組み込むのはどうでしょうか。
[#38067] Re: [ruby-cvs:29304] Ruby:r22086 (trunk): * ruby.c (process_options): set initial default_external before -r. — "Yugui (Yuki Sonoda)" <yugui@...>
Yuguiです。
[#38075] [Bug #1198] corrupted iteratoin during "enum_for :inject" — Shyouhei Urabe <redmine@...>
Bug #1198: corrupted iteratoin during "enum_for :inject"
[#38080] [Feature:trunk] nested loop construct — Yukihiro Matsumoto <matz@...>
まつもと ゆきひろです
ささだです.
[#38096] 多重代入やメソッド引数の展開でto_aが呼ばれます — nagachika <nagachika00@...>
nagachika と申します。
前田です。
まつもと ゆきひろです
前田です。
In article <704d5db90907141754p285e6e51xdd3208b27d556906@mail.gmail.com>,
[#38098] ブロック引数と括弧・引数なしsuper — Shugo Maeda <shugo@...>
前田です。
まつもと ゆきひろです
[ruby-dev:37892] 配列の重複検出用Hashの使いまわし
ワナベと申します。
ruby-1.9では配列内の重複要素の検出のために
内部でHashオブジェクトが生成されますが、
これをスレッドローカルに保存して使いまわすことで
オブジェクト生成とGCの回数を減らすパッチを書きました。
$ cat ../bm_array_overlap.rb
require 'benchmark'
n = 200000
Benchmark.bm do |x|
srand(0)
a, b = Array.new(2) { Array.new(20) { rand(20) } }
x.report("&") { n.times { a & b } }
x.report("|") { n.times { a | b } }
x.report("-") { n.times { a - b } }
puts " --- with thread ---"
x.report("&") { n.times { Thread.new { a & b } } }
x.report("|") { n.times { Thread.new { a | b } } }
x.report("-") { n.times { Thread.new { a - b } } }
puts " --- GC.disable ---"
GC.disable
x.report("&") { n.times { a & b } }
x.report("|") { n.times { a | b } }
x.report("-") { n.times { a - b } }
end
$ ./ruby -Ilib ../bm_array_overlap.rb
user system total real
& 3.672000 0.047000 3.719000 ( 3.750000)
| 5.641000 0.078000 5.719000 ( 5.765625)
- 3.515000 0.031000 3.546000 ( 3.546875)
--- with thread ---
& 17.985000 22.328000 40.313000 ( 52.562500)
| 18.922000 23.719000 42.641000 ( 54.062500)
- 20.828000 23.109000 43.937000 ( 55.734375)
--- GC.disable ---
& 3.766000 0.032000 3.798000 ( 3.828125)
| 5.844000 0.109000 5.953000 ( 5.984375)
- 3.609000 0.109000 3.718000 ( 3.734375)
$ /usr/local/bin/ruby ../bm_array_overlap.rb
user system total real
& 5.359000 0.110000 5.469000 ( 5.515625)
| 7.875000 0.109000 7.984000 ( 8.015625)
- 6.875000 0.250000 7.125000 ( 7.187500)
--- with thread ---
& 18.391000 22.984000 41.375000 ( 52.625000)
| 19.547000 23.172000 42.719000 ( 54.718750)
- 20.063000 23.828000 43.891000 ( 57.203125)
--- GC.disable ---
& 5.032000 0.094000 5.126000 ( 5.187500)
| 6.515000 0.219000 6.734000 ( 7.000000)
- 4.375000 0.250000 4.625000 ( 9.640625)
$ svn diff array.c
Index: array.c
===================================================================
--- array.c (revision 22023)
+++ array.c (working copy)
@@ -2866,9 +2866,15 @@
static VALUE
ary_make_hash(VALUE ary1, VALUE ary2)
{
- VALUE hash = rb_hash_new();
+ VALUE hash = rb_thread_local_aref(rb_thread_current(),
rb_intern("ary_overlap_check_hash"));
long i;
+ if (hash == Qnil) {
+ hash = rb_hash_new();
+ rb_thread_local_aset(rb_thread_current(),
rb_intern("ary_overlap_check_hash"), hash);
+ } else {
+ rb_funcall(hash, rb_intern("clear"), 0);
+ }
for (i=0; i<RARRAY_LEN(ary1); i++) {
rb_hash_aset(hash, RARRAY_PTR(ary1)[i], Qtrue);
}
--
ワナベ