Title: Quadratic behavior in xml.etree.ElementPath Index Predicates · Issue #152674 · python/cpython · GitHub
Open Graph Title: Quadratic behavior in xml.etree.ElementPath Index Predicates · Issue #152674 · python/cpython
X Title: Quadratic behavior in xml.etree.ElementPath Index Predicates · Issue #152674 · python/cpython
Description: Element.findall() and fully-consumed Element.iterfind() exhibit O(n^2) time complexity when using XPath index predicates ([1], [last()], [last()-N]) on XML documents with many same-tag siblings. Element.find() is only affected when the f...
Open Graph Description: Element.findall() and fully-consumed Element.iterfind() exhibit O(n^2) time complexity when using XPath index predicates ([1], [last()], [last()-N]) on XML documents with many same-tag siblings. El...
X Description: Element.findall() and fully-consumed Element.iterfind() exhibit O(n^2) time complexity when using XPath index predicates ([1], [last()], [last()-N]) on XML documents with many same-tag siblings. El...
Opengraph URL: https://github.com/python/cpython/issues/152674
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Quadratic behavior in xml.etree.ElementPath Index Predicates","articleBody":"`Element.findall()` and fully-consumed `Element.iterfind()` exhibit *O*(*n*^2) time complexity when using XPath index predicates (`[1]`, `[last()]`, `[last()-N]`) on XML documents with many same-tag siblings.\n`Element.find()` is only affected when the first match is near the end of the sibling list, such as with `[last()]` or `[last()-N]`; `.//item[1]` short-circuits after the first match.\n\n(reported privately by @DarkaMaul)\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-152676\n* gh-154810\n* gh-154811\n* gh-154812\n* gh-154813\n* gh-154814\n* gh-154815\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/encukou","@type":"Person","name":"encukou"},"datePublished":"2026-06-30T11:16:21Z","url":"https://github.com/python/cpython/issues/152674"}
| 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:a4b58451-792b-dc14-8d29-5d3fd8679ad3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8604:2EA4A8:6C05:916E:6AFDA7C3 |
| html-safe-nonce | a7ad6ea56122784b3e291b589f414ac4e1a250798365136492ec6e8045d75f64 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NjA0OjJFQTRBODo2QzA1OjkxNkU6NkFGREE3QzMiLCJ2aXNpdG9yX2lkIjoiODMyMjU5NTUyNjk4MTU2MDI1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 08337f8fdadc740e74e8e03d814c8558f5e83044ac82bffe71a8a178b3c37a37 |
| hovercard-subject-tag | issue:4776231246 |
| 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/152674/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4773c83ca2f549004d93bd821ae0d5c54c6956099b40597c596a864a973cf528/python/cpython/issues/152674 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4773c83ca2f549004d93bd821ae0d5c54c6956099b40597c596a864a973cf528/python/cpython/issues/152674 |
| og:image:alt | Element.findall() and fully-consumed Element.iterfind() exhibit O(n^2) time complexity when using XPath index predicates ([1], [last()], [last()-N]) on XML documents with many same-tag siblings. El... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | encukou |
| hostname | github.com |
| expected-hostname | github.com |
| None | bc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea |
| 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 | 0ddf53eb35c87f1f8df13dbf75c3bdadbfc6e969 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width