[#31692] cannot run test-all — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
9 messages
2007/09/01
[#31697] Re: [ruby-list:43970] 次の1.8.6 — Tadayoshi Funaba <tadf@...>
> * [ruby-dev:31379]がペンディング
10 messages
2007/09/01
[#31699] Re: [ruby-list:43970] 次の1.8.6
— Urabe Shyouhei <shyouhei@...>
2007/09/01
Tadayoshi Funaba wrote:
[#31700] Re: [ruby-list:43970] 次の1.8.6
— Tadayoshi Funaba <tadf@...>
2007/09/01
> > WIN32OLE も Time も担当でないし、この報告が何をいいたいのかもよくわか
[#31703] Re: [ruby-list:43970] 次の1.8.6
— Urabe Shyouhei <shyouhei@...>
2007/09/01
Tadayoshi Funaba wrote:
[#31706] Re: [ruby-list:43970] 次の1.8.6
— Tadayoshi Funaba <tadf@...>
2007/09/01
> 今後サポートを続けるべきかはご判断にお任せします。OLEで使われてるん
[#31709] [BUG] non-initialized struct — Tanaka Akira <akr@...>
以下のようにすると [BUG] が出ます。
6 messages
2007/09/02
[#31715] string literal encoding — Nobuyoshi Nakada <nobu@...>
なかだです。
12 messages
2007/09/02
[#31716] Re: string literal encoding
— Yukihiro Matsumoto <matz@...>
2007/09/02
まつもと ゆきひろです
[#31729] packed st_table — Nobuyoshi Nakada <nobu@...>
なかだです。
8 messages
2007/09/04
[#31734] [m17n] String#chop & String#succ — Nobuyoshi Nakada <nobu@...>
なかだです。
2 messages
2007/09/05
[#31744] [m17n] String#encode — Nobuyoshi Nakada <nobu@...>
なかだです。
7 messages
2007/09/06
[#31768] shellescape — "Akinori MUSHA" <knu@...>
shellwords.rb に shellescape() 等を追加しようと思います。
5 messages
2007/09/10
[#31774] RSTRING(value)->ptr == NULL ? — Tietew <tietew+ruby-dev@...>
Tietew です。
7 messages
2007/09/11
[#31778] Re: RSTRING(value)->ptr == NULL ?
— Yukihiro Matsumoto <matz@...>
2007/09/12
まつもと ゆきひろです
[#31781] `scan': character encodings differ (ArgumentError) — Kouhei Sutou <kou@...>
須藤です。
5 messages
2007/09/15
[#31787] 文字列のinspect — eklerni <eklerni@...>
eklerniといいます。
5 messages
2007/09/15
[#31798] generator from Enumerable#map — "Yusuke ENDOH" <mame@...>
遠藤と申します。
7 messages
2007/09/19
[#31810] rb_obj_is_kind_of — Tanaka Akira <akr@...>
rb_obj_is_kind_of の TYPE(cl) ですが、[ruby-dev:31805] の例
5 messages
2007/09/21
[#31815] 文字列の式展開 — eklerni <eklerni@...>
eklerniといいます。
6 messages
2007/09/22
[#31835] Kernel#` is blocked with Ruby/GLib2 on Intel Mac — Kouhei Sutou <kou@...>
須藤です。
5 messages
2007/09/24
[#31842] 拡張ライブラリ内での SIGVTALRM — とみたまさひろ <tommy@...>
とみたです。
10 messages
2007/09/24
[#31848] huge `if' dumps core — "Yusuke ENDOH" <mame@...>
遠藤と申します。
5 messages
2007/09/24
[#31850] meta programming might dump core — "Yusuke ENDOH" <mame@...>
遠藤と申します。
2 messages
2007/09/24
[#31853] optimize T_OBJECT space — Tanaka Akira <akr@...>
T_OBJECT なインスタンスで、インスタンス変数の名前をクラス側
7 messages
2007/09/25
[#31880] Re: optimize T_OBJECT space
— Tanaka Akira <akr@...>
2007/09/28
In article <87r6kne799.fsf@fsij.org>,
[ruby-dev:31765] Re: packed st_table
From:
Nobuyoshi Nakada <nobu@...>
Date:
2007-09-09 08:38:29 UTC
List:
ruby-dev #31765
なかだです。
At Sat, 8 Sep 2007 21:22:27 +0900,
Tanaka Akira wrote in [ruby-dev:31761]:
> 測ってみたところ、どうも 1要素の場合しかメモり節約の効果が見
> られないので調べてみたところ、以下のような修正が必要なようで
すいません、まだいろいろ途中だったようです。
> す。add_direct_packed の先頭のコードはよくわかりませんでした。
これは、iterationの途中でunpackしてしまうとなにかと不都合が起き
そうなので、単純に追加するようにしたんですが、foreachのほうで
チェックするほうがいいかもしれません。
[ruby-dev:31729]からの差分です。
diff -wU2 st.c st.c
--- st.c (working copy)
+++ st.c (working copy)
@@ -172,6 +172,6 @@
tbl->type = type;
tbl->num_entries = 0;
- tbl->entries_packed = 1;
- tbl->num_bins = 0;
+ tbl->entries_packed = size == ST_DEFAULT_INIT_TABLE_SIZE;
+ tbl->num_bins = tbl->entries_packed ? 0 : size;
tbl->bins = calloc(size, sizeof(st_table_entry*));
tbl->head = 0;
@@ -350,8 +350,5 @@
unsigned int i;
- if (table->num_bins >= ST_DEFAULT_INIT_TABLE_SIZE / r * r) {
- table->bins = xrealloc(table->bins, sizeof(struct st_table_entry *) * (table->num_bins+r));
- }
- else if (!PACKABLE(table, table->num_bins+r)) {
+ if (!PACKABLE(table, table->num_bins+r)) {
return 0;
}
@@ -458,4 +455,6 @@
*new_table = *old_table;
+ if (old_table->entries_packed)
+ num_bins = ST_DEFAULT_INIT_TABLE_SIZE;
new_table->bins = calloc(num_bins, sizeof(st_table_entry*));
@@ -601,9 +600,10 @@
for (i = j = 0; i < table->num_bins; i += r) {
if ((st_data_t)table->bins[i] != never && i > j) {
- memcpy(&table->bins[j], table->bins[i],
+ memcpy(&table->bins[j], &table->bins[i],
sizeof(st_table_entry *) * r);
- j++;
+ j += r;
}
}
+ table->num_bins = j;
return;
}
@@ -639,4 +639,13 @@
val = (st_data_t)table->bins[i+1];
retval = (*func)(key, val, arg);
+ if (!table->entries_packed) {
+ if ((ptr = table->head) != 0) {
+ while (i > 0) {
+ ptr = ptr->fore;
+ i -= r;
+ }
+ }
+ goto linked;
+ }
switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
@@ -649,5 +658,5 @@
table->num_entries--;
if (i >= (table->num_bins -= r)) return 0;
- memmove(&table->bins[i], &table->bins[i+1],
+ memmove(&table->bins[i], &table->bins[i+r],
sizeof(struct st_table_entry*) * (table->num_bins-i));
break;
@@ -658,4 +667,5 @@
if ((ptr = table->head) != 0) {
+ linked:
do {
end = ptr->fore == table->head;
@@ -712,4 +722,13 @@
val = (st_data_t)table->bins[i+1];
retval = (*func)(key, val, arg);
+ if (!table->entries_packed) {
+ if ((ptr = table->head) != 0) {
+ while (i > 0) {
+ ptr = ptr->fore;
+ i -= r;
+ }
+ }
+ goto linked;
+ }
switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
@@ -722,5 +741,5 @@
table->num_entries--;
if (i >= (table->num_bins -= r)) break;
- memmove(&table->bins[i], &table->bins[i+1],
+ memmove(&table->bins[i], &table->bins[i+r],
sizeof(struct st_table_entry*) * (table->num_bins-i));
break;
@@ -732,4 +751,5 @@
if ((ptr = table->head) != 0) {
ptr = ptr->back;
+ linked:
do {
end = ptr == table->head;
--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦