Feature #6199

Organize gc.c a bit

Added by Yura Sokolov about 3 years ago. Updated over 2 years ago.

[ruby-core:43592]
Status:Closed
Priority:Normal
Assignee:Narihiro Nakamura

Description

  1. Move immutable fields from struct heaps_slot and struct sorted_heaps_slot into struct heaps_header. One exception is limit field, but it starts to be mutable just before freeing a heaps_header, so that it is not big issue.
  2. Embed bitmap into struct heaps_slot
  3. Change free_unused_heaps to free_unused_heap, so that it will not be called on every GC round, but only when page should be freed. While free_unused_heaps does not consume much time (it is invisible in profiler), but regular application has no need in calling this function every time.

https://github.com/ruby/ruby/pull/108
https://github.com/ruby/ruby/pull/108.patch

Associated revisions

Revision 37613
Added by nari over 2 years ago

  • gc.c: move immutable fields from struct heaps_slot and struct sorted_heaps_slot into struct heaps_header. Based on a patch from Sokolov Yura [Feature #6199]

Revision 37613
Added by nari over 2 years ago

  • gc.c: move immutable fields from struct heaps_slot and struct sorted_heaps_slot into struct heaps_header. Based on a patch from Sokolov Yura [Feature #6199]

History

#1 Updated by Yusuke Endoh about 3 years ago

  • Status changed from Open to Assigned

#2 Updated by Narihiro Nakamura over 2 years ago

Hi,

I'm sorry for late reply. I've just reviewed these.
I'm not sure that 3. improves a performance, because it's using binary search each one slot.

I don't like 2.

I will accept 1.

Thank you!

#3 Updated by Yura Sokolov over 2 years ago

I'm not sure that 3. improves a performance, because it's using binary search each one slot.

Well, free_unused_heaps runs on each GC and does linear scan, and free_unused_heap runs only on heap's freeing.
Heap freeing occurs rare in typical long running application, so that it is possibly that linear scan for each GC is overkill.

But I could not prove it :)

#4 Updated by Narihiro Nakamura over 2 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r37613.
Yura, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • gc.c: move immutable fields from struct heaps_slot and struct sorted_heaps_slot into struct heaps_header. Based on a patch from Sokolov Yura [Feature #6199]

Also available in: Atom PDF