Title: Specialized `match_keys` for exact dictionary type · Issue #93714 · python/cpython · GitHub
Open Graph Title: Specialized `match_keys` for exact dictionary type · Issue #93714 · python/cpython
X Title: Specialized `match_keys` for exact dictionary type · Issue #93714 · python/cpython
Description: Feature or enhancement I think it's probably worthwhile to write a specialized version of match_keys (for structural pattern matching of mappings) for exact dictionary types Pitch The most common mapping type is almost certainly the buil...
Open Graph Description: Feature or enhancement I think it's probably worthwhile to write a specialized version of match_keys (for structural pattern matching of mappings) for exact dictionary types Pitch The most common m...
X Description: Feature or enhancement I think it's probably worthwhile to write a specialized version of match_keys (for structural pattern matching of mappings) for exact dictionary types Pitch The most comm...
Opengraph URL: https://github.com/python/cpython/issues/93714
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Specialized `match_keys` for exact dictionary type","articleBody":"**Feature or enhancement**\r\n\r\nI think it's probably worthwhile to write a specialized version of `match_keys` (for structural pattern matching of mappings) for exact dictionary types\r\n\r\n**Pitch**\r\n\r\nThe most common mapping type is almost certainly the built-in `dict`. The `match_keys` function in ceval.c could be specialized to handle this type. Doing so would allow you to skip the dummy `object`, and replace the `get` call with `PyDict_GetItemWithError`. I don't think this should change the observable behaviour at all for exact `dict`\r\n\r\nI'm in the process of reimplementing structural pattern matching on Cython, and this change gives ~2x optimization of some microbenchmarks.\r\n\r\nIf this change is deemed desirable I'm happy to implement it myself.\r\n\r\n**Previous discussion**\r\n\r\nNot aware of any\r\n\r\n\u003c!--\r\n New features to Python should first be discussed elsewhere before creating issues on GitHub,\r\n for example in the \"ideas\" category (https://discuss.python.org/c/ideas/6) of discuss.python.org,\r\n or the python-ideas mailing list (https://mail.python.org/mailman3/lists/python-ideas.python.org/).\r\n Use this space to post links to the places where you have already discussed this feature proposal:\r\n--\u003e\r\n\r\n\r\n\u003c!--\r\nYou can freely edit this text. Remove any lines you believe are unnecessary.\r\n--\u003e\r\n","author":{"url":"https://github.com/da-woods","@type":"Person","name":"da-woods"},"datePublished":"2022-06-11T09:23:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/93714/cpython/issues/93714"}
| 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:8a9a6e24-28f5-bc95-a0a8-166d299c8928 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A9FC:179B13:2F8D5E:401EC8:6A526FFD |
| html-safe-nonce | dc904e3a1e1615ab649d37a921954677e8d2d8854bcc5034574a57e1d34576e6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUZDOjE3OUIxMzoyRjhENUU6NDAxRUM4OjZBNTI2RkZEIiwidmlzaXRvcl9pZCI6IjEyODYxMDc3MTYzOTAxMjE0NjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 50f5cada79bd593815678a580bf4a46d8994879fd3e3048c30d71789a4d7d499 |
| hovercard-subject-tag | issue:1268217330 |
| 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/93714/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c60da4b17eabbff364bcf40375a27ec0732140a25cad6f76a9126c3361c8d501/python/cpython/issues/93714 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c60da4b17eabbff364bcf40375a27ec0732140a25cad6f76a9126c3361c8d501/python/cpython/issues/93714 |
| og:image:alt | Feature or enhancement I think it's probably worthwhile to write a specialized version of match_keys (for structural pattern matching of mappings) for exact dictionary types Pitch The most common m... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | da-woods |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width