Title: gh-132917: Check resident set size (RSS) before GC trigger. by nascheme · Pull Request #133399 · python/cpython · GitHub
Open Graph Title: gh-132917: Check resident set size (RSS) before GC trigger. by nascheme · Pull Request #133399 · python/cpython
X Title: gh-132917: Check resident set size (RSS) before GC trigger. by nascheme · Pull Request #133399 · python/cpython
Description: This greatly reduces the time to run the script in GH-132917. For the default build, I get 0.19 seconds to run. For free-threaded build main branch, 1.9 seconds. With this PR applied, 0.2 seconds. I've tried to implement a get_current_rss() function that works on Linux, MacOS, Windows, FreeBSD and OpenBSD. If the platform doesn't have an implementation or the function fails, gc_should_collect() reverts to the old behavior. I did not implement this for the default build GC yet. I think we should try it in 3.14 for only the free-threaded build. If it seems to work okay, we can add a similar RSS check for the default GC collection threshold check. As conditions, I'm using RSS increase of 10% or young object count increase of 40 x threshold. I think this is quite conservative in terms of running the GC often enough. Issue: gh-132917
Open Graph Description: This greatly reduces the time to run the script in GH-132917. For the default build, I get 0.19 seconds to run. For free-threaded build main branch, 1.9 seconds. With this PR applied, 0.2 second...
X Description: This greatly reduces the time to run the script in GH-132917. For the default build, I get 0.19 seconds to run. For free-threaded build main branch, 1.9 seconds. With this PR applied, 0.2 second...
Opengraph URL: https://github.com/python/cpython/pull/133399
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:8dbaf375-291f-e771-dbe0-37acc55fc934 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 81DA:1BD726:C75FB1:1085E08:6A5408C0 |
| html-safe-nonce | 0fadbceb7e1ebe453c7a3d0cb041eb48ed44a22079f9f1e90d7897321e522896 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MURBOjFCRDcyNjpDNzVGQjE6MTA4NUUwODo2QTU0MDhDMCIsInZpc2l0b3JfaWQiOiI2MzQ2Mjk2MTAyNzI0MzA3MTM2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1444994bdb43628bcbf9b7a9f1a2aeb428260d71500ad890fe2f829547ef0942 |
| hovercard-subject-tag | pull_request:2497470773 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/133399/files |
| twitter:image | https://avatars.githubusercontent.com/u/690853?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/690853?s=400&v=4 |
| og:image:alt | This greatly reduces the time to run the script in GH-132917. For the default build, I get 0.19 seconds to run. For free-threaded build main branch, 1.9 seconds. With this PR applied, 0.2 second... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width