Title: Performance bottleneck in `prune_unwanted_nodes` causing 200ms per call · Issue #750 · adbar/trafilatura · GitHub
Open Graph Title: Performance bottleneck in `prune_unwanted_nodes` causing 200ms per call · Issue #750 · adbar/trafilatura
X Title: Performance bottleneck in `prune_unwanted_nodes` causing 200ms per call · Issue #750 · adbar/trafilatura
Description: When profiling trafilatura.bare_extraction method for some pages that took us a while to parse, I found that significant performance issues in extract_content method. Root cause: Too many calls to prune_unwanted_node with each call takin...
Open Graph Description: When profiling trafilatura.bare_extraction method for some pages that took us a while to parse, I found that significant performance issues in extract_content method. Root cause: Too many calls to ...
X Description: When profiling trafilatura.bare_extraction method for some pages that took us a while to parse, I found that significant performance issues in extract_content method. Root cause: Too many calls to ...
Opengraph URL: https://github.com/adbar/trafilatura/issues/750
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Performance bottleneck in `prune_unwanted_nodes` causing 200ms per call","articleBody":"When profiling `trafilatura.bare_extraction` method for some pages that took us a while to parse, I found that significant performance issues in `extract_content` method. \r\n\r\n**Root cause**: Too many calls to `prune_unwanted_node` with each call taking upto ~200ms.\r\n\r\n**Steps to reproduce**:\r\n1. Run python with cProfile profiler on `bare_extraction`\r\n2. Try to scrape and parse this page https://nlewo.github.io/nixos-manual-sphinx/generated/options-db.xml.html\r\n3. Observe `prune_unwanted_node` timing\r\n\r\n**Questions**\r\n1. Are there existing configuration options or alternative methods in trafilatura to bypass/optimize this operation?\r\n2. Could we leverage Rust/C++ based HTML parsing libraries (like lxml-rs or html5ever) to accelerate node pruning?\r\n3. Could we leverage caching to reduce latency?\r\n","author":{"url":"https://github.com/thsunkid","@type":"Person","name":"thsunkid"},"datePublished":"2024-11-23T20:48:47Z","url":"https://github.com/adbar/trafilatura/issues/750"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| 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:203456b0-baf9-21a0-52ff-1e7a3b513505 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E77C:14D062:3CB22F:53D263:6AEDB46B |
| html-safe-nonce | 7396e76d718b04c9a02b4bc1c7da60cfb31a94c2777fe23a5ae8f2db3faccc89 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzdDOjE0RDA2MjozQ0IyMkY6NTNEMjYzOjZBRURCNDZCIiwidmlzaXRvcl9pZCI6IjExOTc3NzQyMjc4MzAwNjAxMzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 21e4c24f045c7af53ee9d15dd7a01a37d4021078809385f2f0455099c6408695 |
| hovercard-subject-tag | issue:2686593053 |
| 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/adbar/trafilatura/750/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ea00f42f649922284528179093195a900c12a0b0774ef92d0f76ce4f29b43cbb/adbar/trafilatura/issues/750 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ea00f42f649922284528179093195a900c12a0b0774ef92d0f76ce4f29b43cbb/adbar/trafilatura/issues/750 |
| og:image:alt | When profiling trafilatura.bare_extraction method for some pages that took us a while to parse, I found that significant performance issues in extract_content method. Root cause: Too many calls to ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | thsunkid |
| hostname | github.com |
| expected-hostname | github.com |
| None | e40242599af5e7da0f281843dec7492c322688d4a48caeea85f9fb8e41c8ea53 |
| turbo-cache-control | no-preview |
| go-import | github.com/adbar/trafilatura git https://github.com/adbar/trafilatura.git |
| octolytics-dimension-user_id | 2125866 |
| octolytics-dimension-user_login | adbar |
| octolytics-dimension-repository_id | 180136168 |
| octolytics-dimension-repository_nwo | adbar/trafilatura |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 180136168 |
| octolytics-dimension-repository_network_root_nwo | adbar/trafilatura |
| 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 | 89cbf2bb52a24fc179bf5925abba0ba574b262ce |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width