Bug #9201
closed[patch] remove GC overhead for loaded_features_index
Description
I was profiling minor GC in our app and noticed 15% of time spent in mark_tbl for loaded_features_index.
The following patch removes this overhead by storing feature offsets outside the ruby heap:
https://github.com/tmm1/ruby/commit/d03c5ece865422f0510957c1dee1d33a1d9eca82
Updated by tmm1 (Aman Karmani) about 11 years ago
In features_index_add_single, we already Check_Type(offset, T_FIXNUM). This ensures these off-heap RArrays will only contain immediates and do not need to be marked.
Updated by tmm1 (Aman Karmani) about 11 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r43974.
Aman, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- load.c (features_index_add_single): Move loaded_features_index array values off
the ruby heap. [Bug #9201] [ruby-core:58805] - load.c (loaded_features_index_clear_i): Clean up off-heap array structure.
- vm.c (rb_vm_mark): Remove unnecessary mark_tbl for loaded_features_index.
This improves minor GC time by 15% in a large application.
Updated by tmm1 (Aman Karmani) about 11 years ago
With this patch along with the one in r43973, minor GC pauses are now up to 45% shorter in our application.
10.times{ s=Time.now; GC.start_minor; p Time.now-s }
r43972¶
0.034701
0.034337
0.038741
0.034126
0.037504
0.033009
0.034526
0.033238
0.034232
0.032667
r43973¶
0.029089
0.027402
0.027296
0.026581
0.028211
0.026294
0.028213
0.030031
0.026412
0.02695
r43974¶
0.024061
0.021339
0.022207
0.022007
0.022716
0.02303
0.022139
0.021704
0.022118
0.021611
Updated by funny_falcon (Yura Sokolov) about 11 years ago
Look at #8158 . Don't know if it still applies, but I will fix it if you interested in.