[#37248] [Feature:1.9] Enumerator#inspect — "Yusuke ENDOH" <mame@...>
遠藤です。
At Tue, 2 Dec 2008 23:59:52 +0900,
まつもと ゆきひろです
こんにちは、なかむら(う)です。
At Wed, 3 Dec 2008 18:39:59 +0900,
[#37265] [Feature #819] Caching Symbol#to_proc — Shumpei Akai <redmine@...>
Feature #819: Caching Symbol#to_proc
[#37275] [Bug #821] uninitialized constant Test::Unit::AutoRunner — Naohisa Goto <redmine@...>
Bug #821: uninitialized constant Test::Unit::AutoRunner
In article <4937d5c0586c_87b76ae0c6417f@redmine.ruby-lang.org>,
[#37278] invalid byte sequence by pack format 'A' or 'a' — "Yugui (Yuki Sonoda)" <yugui@...>
Yuguiです。
[#37295] [BUG:trunk] Encoding in which Array#pack returns when the last format is 'u', 'M', 'm' — "Yugui (Yuki Sonoda)" <yugui@...>
Yuguiです。
まつもと ゆきひろです
[#37337] [Feature #841] Object#self — "rubikitch ." <redmine@...>
Feature #841: Object#self
まつもと ゆきひろです
こんにちは、なかむら(う)です。
[#37357] Math and NaN — Tadayoshi Funaba <tadf@...>
Math.sin に NaN を与えてもそのまま NaN が返ってきますが、Math.sqrt はエ
まつもと ゆきひろです
> |Math.sin に NaN を与えてもそのまま NaN が返ってきますが、Math.sqrt はエ
[#37370] IA-64とx64でBigDecimalの割り算の計算結果がおかしい — TAKANO Mitsuhiro <tak@...32.tk>
-----BEGIN PGP SIGNED MESSAGE-----
[#37378] Ruby開発ミーティングログ — SASADA Koichi <ko1@...>
ささだです.
こんにちは、なかむら(う)です。
こんにちは、なかむら(う)です。
[#37384] [Bug #853] Rake のテストが無い — okkez _ <redmine@...>
Bug #853: Rake のテストが無い
[#37390] [BUG:trunk] r20625 dumps core and many strings associated with wrong encoding — "Yugui (Yuki Sonoda)" <yugui@...>
Yuguiです。
Yugui (Yuki Sonoda) さんは書きました:
[#37392] [1.9:Feature] faster bignum multiplication by karatsuba method — "Yusuke ENDOH" <mame@...>
遠藤です。
[#37427] Re: [ruby-core:20448] [Bug #727] Signal(CLD) seems not to work on OS X — "Yugui (Yuki Sonoda)" <yugui@...>
Yuguiです。
[#37455] Re: [ruby-cvs:27996] Ruby:r20778 (trunk): * common.mk (complex.$(OBJEXT), rational.$(OBJEXT)): Properly add — Nobuyoshi Nakada <nobu@...>
なかだです。
At Tue, 16 Dec 2008 15:14:40 +0900,
[#37458] [Bug #891] MiniTest::Assertions#assert_instance_of should use Object#instance_of? — okkez _ <redmine@...>
Bug #891: MiniTest::Assertions#assert_instance_of should use Object#instance_of?
[#37483] (was Re: [ruby-cvs:28066]) — "Akinori MUSHA" <knu@...>
At Wed, 17 Dec 2008 19:57:17 +0900 (JST),
(2008/12/17 20:25), Akinori MUSHA wrote:
At Thu, 18 Dec 2008 00:56:00 +0900,
[#37490] minitest/spec, minitest/mock を標準添付から外しませんか? — okkez <okkez000@...>
okkez です。
[#37496] when to use default_internal — "Yugui (Yuki Sonoda)" <yugui@...>
Yuguiです。
[#37505] Re: [ruby-cvs:28084] Ruby:r20866 (trunk): * error.c (exc_equal): duck typing equal to make it transitive. — "Yugui (Yuki Sonoda)" <yugui@...>
Yuguiです。
[#37513] Current status of 1.9.1 RC1's issues — "Yugui (Yuki Sonoda)" <yugui@...>
Hi, folks
咳といいます。
Yuguiです
咳といいます。
On 12/21/08 11:22 PM, Masatoshi SEKI wrote:
咳といいます。
Yuguiです。
Yuguiです。
[#37525] [Bug #914] Integer#upto(NaN) — tadayoshi funaba <redmine@...>
Bug #914: Integer#upto(NaN)
[#37537] [Bug #913] mathn した場合、sqrt(NaN) が複素数になる — Yuki Sonoda <redmine@...>
チケット #913 が更新されました。 (by Yuki Sonoda)
[#37555] [Bug #919] tool/file2lastrev.rbでエラー — Tadashi Saito <redmine@...>
Bug #919: tool/file2lastrev.rbでエラー
[#37560] fail to complie ext pty in cygwin — Masaki Suketa <masaki.suketa@...>
助田です。
[#37572] [Bug:1.9] `initialize_copy': wrong argument type #<Class:0x825d23c> (expected Data) (TypeError) — Tanaka Akira <akr@...>
以下のプログラムで、
まつもと ゆきひろです
なかだです。
まつもと ゆきひろです
[#37576] [BUG:trunk] encoding for stdio's — "Yugui (Yuki Sonoda)" <yugui@...>
Yuguiです。
[#37591] [BUG:trunk] [m17n] TestCSVFeatures fails because of r20905 — "Yugui (Yuki Sonoda)" <yugui@...>
Yuguiです。
[#37646] [Bug #943] Segmentation fault (cygwin) — Martin Dürst <redmine@...>
Bug #943: Segmentation fault (cygwin)
[ruby-dev:37265] [Feature #819] Caching Symbol#to_proc
Feature #819: Caching Symbol#to_proc
http://redmine.ruby-lang.org/issues/show/819
起票者: Shumpei Akai
ステータス: Open, 優先度: Normal
Symbol#to_proc で毎回オブジェクトを生成するのは無駄な気がするので,
いくつかキャッシュしてはどうでしょうか.
require 'benchmark'
N=10000
syms_miss=(1..500).map{|i|"a#{i}".to_sym}syms_hit=[:a]*500
Benchmark.bm do|r|
r.report("miss"){N.times{syms_miss.each{|x|x.to_proc}}}
r.report(" hit"){N.times{syms_hit.each{|x|x.to_proc}}}
end
上のようなベンチマークを取ると,次のようになります.
% ruby_trunk -v
ruby 1.9.1 (2008-12-03 patchlevel 5000 revision 20460) [x86_64-linux]
キャッシュなし
user system total real
miss 9.060000 0.040000 9.100000 ( 9.092981)
hit 9.070000 0.050000 9.120000 ( 9.114511)
キャッシュあり
user system total real
miss 9.260000 0.020000 9.280000 ( 9.282089)
hit 0.750000 0.000000 0.750000 ( 0.757002)
以下パッチです
Index: string.c
===================================================================
--- string.c (リビジョン 20465)
+++ string.c (作業コピー)
@@ -6912,13 +6912,37 @@
* (1..3).collect(&:to_s) #=> ["1", "2", "3"]
*/
+static VALUE sym_proc_cache=Qfalse;
+#define SYM_PROC_CACHE_SIZE 64
static VALUE
sym_to_proc(VALUE sym)
{
- return rb_proc_new(sym_call, (VALUE)SYM2ID(sym));
-}
+ VALUE proc;
+ ID id;
+ long sym_index,proc_index;
+ VALUE *aryp;
+ if(!sym_proc_cache){
+ rb_global_variable(&sym_proc_cache);
+ sym_proc_cache = rb_ary_new2(SYM_PROC_CACHE_SIZE * 2);
+ }
+
+ id=SYM2ID(sym);
+ sym_index= (id % SYM_PROC_CACHE_SIZE) << 1;
+ proc_index = sym_index | 1;
+
+ aryp=RARRAY_PTR(sym_proc_cache);
+ if(aryp[sym_index]==sym){
+ return aryp[proc_index];
+ }else{
+ proc = rb_proc_new(sym_call, (VALUE)id);
+ aryp[sym_index]=sym;
+ aryp[proc_index]=proc;
+ return proc;
+ }
+}
+
static VALUE
sym_succ(VALUE sym)
----------------------------------------
http://redmine.ruby-lang.org