[前][次][番号順一覧][スレッド一覧]

ruby-changes:60385

From: Jean <ko1@a...>
Date: Fri, 13 Mar 2020 21:52:07 +0900 (JST)
Subject: [ruby-changes:60385] 215eb86a77 (ruby_2_7): Increase the frozen_strings table initial size

https://git.ruby-lang.org/ruby.git/commit/?id=215eb86a77

From 215eb86a7729bf0db487f399031ad55a1062fada Mon Sep 17 00:00:00 2001
From: Jean Boussier <jean.boussier@g...>
Date: Wed, 15 Jan 2020 14:40:01 +0100
Subject: Increase the frozen_strings table initial size

It was set to 1000 in a4a2b9be7a55bb61d17cf9673ed0d2a93bb52d31.

However on ruby-2.7.0p0, there are much more than 1k frozen string right after boot:

```
$ ruby -robjspace -e 'p ObjectSpace.each_object(String).select { |s| s.frozen? && ObjectSpace.dump(s).include?(%{"fstring":true})}.uniq.count'
5948
```

diff --git a/vm.c b/vm.c
index bb3ffae..bf33d27 100644
--- a/vm.c
+++ b/vm.c
@@ -3330,7 +3330,7 @@ Init_vm_objects(void) https://github.com/ruby/ruby/blob/trunk/vm.c#L3330
     /* initialize mark object array, hash */
     vm->mark_object_ary = rb_ary_tmp_new(128);
     vm->loading_table = st_init_strtable();
-    vm->frozen_strings = st_init_table_with_size(&rb_fstring_hash_type, 1000);
+    vm->frozen_strings = st_init_table_with_size(&rb_fstring_hash_type, 10000);
 }
 
 /* top self */
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]