Title: optimize CheckedSession.__setattr__ or ._check_key_value · Issue #1171 · larray-project/larray · GitHub
Open Graph Title: optimize CheckedSession.__setattr__ or ._check_key_value · Issue #1171 · larray-project/larray
X Title: optimize CheckedSession.__setattr__ or ._check_key_value · Issue #1171 · larray-project/larray
Description: It is currently much more expensive than necessary (it recomputes annotations and TypeAdapter on each attribute set, whether that particular attribute has already been set or not). This is not super important though given that we use it ...
Open Graph Description: It is currently much more expensive than necessary (it recomputes annotations and TypeAdapter on each attribute set, whether that particular attribute has already been set or not). This is not supe...
X Description: It is currently much more expensive than necessary (it recomputes annotations and TypeAdapter on each attribute set, whether that particular attribute has already been set or not). This is not supe...
Opengraph URL: https://github.com/larray-project/larray/issues/1171
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"optimize CheckedSession.__setattr__ or ._check_key_value","articleBody":"It is currently much more expensive than necessary (it recomputes annotations and TypeAdapter on each attribute set, whether that particular attribute has already been set or not). This is not super important though given that we use it to store arrays which themselves take much more time to compute than the attribute setter. Still, in some rare workflows, I think this could make a difference. **Edit**: Note that even nested loops setting one element of an array at a time should not be impacted because those are using `__setitem__` on the arrays themselves, not `__setattr__` or `__setitem__` on the session, so this would be even rarer than I initially thought.\n\nIt should be possible to cache setters (like Pydantic itself does BTW). I have actually tried doing so (yet another instance of a \"how hard could it be?\" 😉) and it ~mostly~ works... ~except inheritance 😢~.","author":{"url":"https://github.com/gdementen","@type":"Person","name":"gdementen"},"datePublished":"2026-03-13T10:21:57Z","url":"https://github.com/larray-project/larray/issues/1171"}
| 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 | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f408ab89-5b23-4a76-582b-b66b1c1265ca |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9448:1DD784:2B412A:3A30E7:6B002532 |
| html-safe-nonce | 4cd1d3b4a6ba1b4dadc58309f943853b43c2b2d8ac0f32be8902e7199bd29903 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDQ4OjFERDc4NDoyQjQxMkE6M0EzMEU3OjZCMDAyNTMyIiwidmlzaXRvcl9pZCI6IjkxMjI3OTAyMzk2NTQzODkwNDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | aef237abedfe9008e8a5834a087de8604a2142d111292e98777d9b4b251fc790 |
| hovercard-subject-tag | issue:4070199831 |
| 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/larray-project/larray/1171/issue_layout |
| twitter:image | https://opengraph.githubassets.com/51219c0368f55da254dbc7cb27f50154b3138733b283e2760450b8eac807b443/larray-project/larray/issues/1171 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/51219c0368f55da254dbc7cb27f50154b3138733b283e2760450b8eac807b443/larray-project/larray/issues/1171 |
| og:image:alt | It is currently much more expensive than necessary (it recomputes annotations and TypeAdapter on each attribute set, whether that particular attribute has already been set or not). This is not supe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gdementen |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/larray-project/larray git https://github.com/larray-project/larray.git |
| octolytics-dimension-user_id | 26460981 |
| octolytics-dimension-user_login | larray-project |
| octolytics-dimension-repository_id | 16981067 |
| octolytics-dimension-repository_nwo | larray-project/larray |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16981067 |
| octolytics-dimension-repository_network_root_nwo | larray-project/larray |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width