Title: Mark all objects reachable from roots as live before doing main cyclic GC pass · Issue #126491 · python/cpython · GitHub
Open Graph Title: Mark all objects reachable from roots as live before doing main cyclic GC pass · Issue #126491 · python/cpython
X Title: Mark all objects reachable from roots as live before doing main cyclic GC pass · Issue #126491 · python/cpython
Description: Objects can only be cyclic garbage if they are not reachable. So, if we can cheaply identify the majority of reachable objects before performing the (relatively slow) cycle detecting pass, we can save a lot of time. Performing a transiti...
Open Graph Description: Objects can only be cyclic garbage if they are not reachable. So, if we can cheaply identify the majority of reachable objects before performing the (relatively slow) cycle detecting pass, we can s...
X Description: Objects can only be cyclic garbage if they are not reachable. So, if we can cheaply identify the majority of reachable objects before performing the (relatively slow) cycle detecting pass, we can s...
Opengraph URL: https://github.com/python/cpython/issues/126491
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Mark all objects reachable from roots as live before doing main cyclic GC pass","articleBody":"Objects can only be cyclic garbage if they are not reachable.\r\nSo, if we can cheaply identify the majority of reachable objects before performing the (relatively slow) cycle detecting pass, we can save a lot of time.\r\n\r\nPerforming a transitive closure of all objects reachable from global roots (the sys and builtins modules as well as builtin class's dicts and sublasses) plus a transitive closure of all objects reachable from the stacks can eliminate \u003e90% of all objects relatively cheaply.\r\n\r\nInitial experiments show a [~3% speedup, with an almost 50% speedup of the most gc-heavy benchmark](https://raw.githubusercontent.com/faster-cpython/benchmarking-public/refs/heads/main/results/bm-20241104-3.14.0a1%2B-5e813c5/bm-20241104-linux-x86_64-faster%252dcpython-mark_first_gc-3.14.0a1%2B-5e813c5-vs-base.svg).\r\n\r\nThis idea has been proposed a few times. \r\n@nascheme has definitely suggested it before. Perhaps he can add links to any prior discussion and/or experiments?\r\n\r\nWhat makes this more feasible now is that the GC can see the evaluation stack of frames, thanks to #124392, so we would now expect that the vast majority of reachable objects can be cheaply marked, thus improving the efficiency of cycle detection considerably.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-126502\n* gh-126983\n* gh-126984\n* gh-127110\n* gh-127519\n* gh-127770\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/markshannon","@type":"Person","name":"markshannon"},"datePublished":"2024-11-06T12:12:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/126491/cpython/issues/126491"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:acad6163-d843-af7c-61de-3f09d5dc211e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8D7A:1A500C:163C0E:1CB710:696AD66F |
| html-safe-nonce | a14f37acb39395ff133329c67edf6b856f9e93e173b85e058712ae33914e6351 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDdBOjFBNTAwQzoxNjNDMEU6MUNCNzEwOjY5NkFENjZGIiwidmlzaXRvcl9pZCI6IjU5Njc5NTg0NjgwMzM0MzUyNDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7e4b106e619244cd299d132ae21aad5618a691094207e3e50a2c27286705f9a5 |
| hovercard-subject-tag | issue:2637923216 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/126491/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9934ef192b7a6a0d3b1fa5bc8827f8f55bb9d01474314b3346603954f6e34b49/python/cpython/issues/126491 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9934ef192b7a6a0d3b1fa5bc8827f8f55bb9d01474314b3346603954f6e34b49/python/cpython/issues/126491 |
| og:image:alt | Objects can only be cyclic garbage if they are not reachable. So, if we can cheaply identify the majority of reachable objects before performing the (relatively slow) cycle detecting pass, we can s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | markshannon |
| hostname | github.com |
| expected-hostname | github.com |
| None | c785f4ce187e9e7331257791b36ddee01625bb8e292a9b4fe2c16d4c006abf5d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c718a376fcf780eb22089171adb84a543f660bf7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width