Title: Preserve native profile events across specialized calls by youknowdot · Pull Request #9912 · RustPython/RustPython · GitHub
Open Graph Title: Preserve native profile events across specialized calls by youknowdot · Pull Request #9912 · RustPython/RustPython
X Title: Preserve native profile events across specialized calls by youknowdot · Pull Request #9912 · RustPython/RustPython
Description: Draft: validation pending Extract the independent legacy sys.setprofile native-call corrections from #9439, on main a7a8fab00. Original implementation/author from bd76a91e4 is preserved and credited in this extraction commit. Emit C events only for native functions and eligible method descriptors, not constructors, callable instances or slot wrappers. Bind method-descriptor event objects independently for call and return/exception. Route seven warmed native-call specializations through the existing vectorcall path while tracing. Do not modify shared bytecode/caches or introduce #9439's monitoring metadata/dispatch split. Preserve full descriptor type names and restore the canonical profile output test. Preserve the focused original regression group, adding positional sort() and repeated profile on/off cycles. Actual validation so far Extracted focused regression group passes on CPython 3.15.2, including warmup and three enable/disable cycles. Changed-file normal hooks, Rustfmt, Ruff and whitespace checks passed. Existing baseline RustPython reproduces the descriptor repr failure. It is not a matched new-main performance baseline. Independent source review found no blocking error in the reviewed extraction; its suggested positional sort and toggle probes are included. Exact-head follow-up validation (4347987) Matched main a7a8fab00 and candidate release binaries built with Rust 1.100, thin LTO and identical minimal stdlib/stdio/importlib/host_env/doc/threading features. First baseline job-2 build was killed with SIGKILL; job-1 retry and candidate build succeeded. Candidate focused native-event probe PASS; canonical test_profile + test_sys_setprofile PASS (36 tests, one pre-existing expected failure); complete stdlib_sys.py snippet PASS. Same-machine alternating 11-sample CPU-pinned wall-clock measurements: loop -2.05%, Python calls +0.44%, native calls -2.85%, generator +4.94%. Samples are noisy; the generator result requires another check and is not a no-regression claim. Earlier seven-sample generator result was -0.71%. Profiling-on workload is not equivalent work: baseline emits 101 native C-event pairs, candidate and CPython 3.15.2 emit 300. The observed +164% wall time cannot be interpreted as inactive-path overhead. Workspace Rust tests, strict Clippy and separate C-API checks are underway. Hosted CI and other-platform/WASI execution remain pending. CPU-time performance verification remains pending. This draft was published first at the owner's request. No merge-readiness or complete CPython profiling parity claim. Existing profile-callback error swallowing is outside this change. #9439 remains separate and still requires its own WASI stack-regression and monitoring performance work. This PR does not fix those issues. AI assistance OpenAI Codex assisted the original implementation, extraction and review. Exact model version is unavailable in this session and is not guessed. Review correction on 128a3ec Refresh cached tracing state after actual eval-breaker work, not on the ordinary untripped hot path. This handles signal/GC callbacks changing profiling before dispatch. Reproduced on 4347987: targeting a warmed positional append call with a signal enabled profiling before an actual append, but omitted its C events in 100/100 targeted deliveries. The corrected binary emits the expected pair in 100/100. General delivery probes match executed append count to C events; corrected RustPython and CPython 3.15.2 both pass 100 deliveries. Signal timing probes are external diagnostics, not flaky mandatory snippet tests. Platforms without POSIX interval signals were not tested locally. GC callback enable/disable and signal-handler exception unwind probes pass on corrected RustPython and CPython 3.15.2. Corrected release binary passes test_profile, test_sys_setprofile, test_sys_settrace, test_monitoring: 582 tests, 82 existing skips. Focused native-event tests and hooks pass. Full workspace/CAPI tests and strict Clippy passed on 4347987 (1597/21 ignored and 153/2 ignored respectively). Exact corrected-head reruns, corrected-head matched performance and fresh CI are pending. Keep draft until these gates finish.
Open Graph Description: Draft: validation pending Extract the independent legacy sys.setprofile native-call corrections from #9439, on main a7a8fab00. Original implementation/author from bd76a91e4 is preserved and credite...
X Description: Draft: validation pending Extract the independent legacy sys.setprofile native-call corrections from #9439, on main a7a8fab00. Original implementation/author from bd76a91e4 is preserved and credite...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9912
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:c0e0b20b-3dba-7835-2460-9be1898b85a4 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B3FE:21AC3F:40EED9A:52296E4:6B01FE4F |
| html-safe-nonce | 04b4257d6018138c24b6abd2b26eb656ef0d4c58c8c3c56fbfa6bffbbe21d395 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCM0ZFOjIxQUMzRjo0MEVFRDlBOjUyMjk2RTQ6NkIwMUZFNEYiLCJ2aXNpdG9yX2lkIjoiNTA4NDQxODQyNDY1NDkyMTI5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 130e7726bf58a862e64039b443b19a00ce61e1bb4e0b6e9884a5d4c6f7423d8a |
| hovercard-subject-tag | pull_request:5359907998 |
| 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/RustPython/RustPython/pull/9912/files |
| twitter:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| og:image:alt | Draft: validation pending Extract the independent legacy sys.setprofile native-call corrections from #9439, on main a7a8fab00. Original implementation/author from bd76a91e4 is preserved and credite... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width