Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compaction support for threads / fibers / continuations / autoload #2225

Closed
wants to merge 1 commit into from

Conversation

1 participant
@tenderlove
Copy link
Member

commented Jun 4, 2019

Like #2212, this is tested against GitHub's Rails app. This reduces the pinned heap in GitHub's app from ~3.2% to ~1.3%:

$ wc -l master.json
 3245847 master.json
$ jq -c 'select(.flags.pinned)' master.json | wc -l
  105928
$ wc -l branch.json
 3239696 branch.json
$ jq -c 'select(.flags.pinned)' branch.json | wc -l
   42137
$ irb
irb(main):001:0> 105928 / 3245847.0
=> 0.03263493319309259
irb(main):002:0> 42137 / 3239696.0
=> 0.013006467273472573
irb(main):003:0> 

Here are graphs of the heaps:

Ruby Master (c9b74f9)

master

This branch

branch

Pinned object statistics:

Master

$ jq 'select(.flags.pinned) | (if .type == "IMEMO" then .imemo_type else .type end)' master.json | sort | uniq -c | sort -n
   1 "COMPLEX"
   1 "MATCH"
   1 "RATIONAL"
   1 "STRUCT"
   1 "svar"
   1 "tmpbuf"
   2 "ast"
   2 "throw_data"
   3 "cref"
   4 "FILE"
   4 "ICLASS"
   6 "FLOAT"
  10 "REGEXP"
  11 "BIGNUM"
  36 "ment"
  44 "iseq"
 122 "HASH"
 151 "ARRAY"
 374 "MODULE"
1118 "OBJECT"
1241 "CLASS"
1394 "DATA"
4859 "STRING"
96541 "env"

This branch

$ jq 'select(.flags.pinned) | (if .type == "IMEMO" then .imemo_type else .type end)' branch.json | sort | uniq -c | sort -n
   1 "COMPLEX"
   1 "RATIONAL"
   1 "STRUCT"
   1 "svar"
   1 "tmpbuf"
   2 "ast"
   2 "throw_data"
   3 "cref"
   4 "FILE"
   5 "ICLASS"
   6 "FLOAT"
  10 "REGEXP"
  11 "BIGNUM"
  25 "iseq"
  42 "ment"
 119 "HASH"
 150 "ARRAY"
 309 "MODULE"
 875 "DATA"
1121 "OBJECT"
1227 "CLASS"
4865 "STRING"
33356 "env"

This PR seems to mostly unpin IMEMO env objects.

@tenderlove tenderlove force-pushed the github:cont-unpin branch 2 times, most recently from 90f59db to 5102f89 Jun 5, 2019

Add compaction support for more types.
This commit adds compaction support for:

* Fibers
* Continuations
* Autoload Constants

@tenderlove tenderlove force-pushed the github:cont-unpin branch from 5102f89 to be3bd3a Jun 10, 2019

@tenderlove tenderlove closed this Jun 11, 2019

@tenderlove tenderlove deleted the github:cont-unpin branch Jun 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.