Repository navigation
perf(preview): focus Hugging Face paper extraction on main - #25
Merged
Merged
Conversation
Hugging Face paper pages are ~150-220 KB of HTML with large header, footer, and hydration chrome. Parse only <head>+<main> before extraction, preserving title/byline/date metadata and all paper, link, and citation blocks while cutting DOM work. Combine the 16 noise-removal selectors into one comma-separated selector so node-html-parser traverses the tree once instead of once per tag. Local benchmarks on the ten HF URLs that hit the Workers Free exceededCpu limit show ~20% lower extraction time with identical block counts; a regression test covers the main-only boundary. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
🔎 Cloudflare preview: https://1cd975a8-feedreader.phatpham9.workers.dev Uploaded from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cloudflare logs showed 10
503 exceededCpuevents on Hugging Face paper previews (10–35ms CPU vs the Workers Free 10ms limit). This reduces the HF paper extraction cost without changing its output:<head>+<main>for Hugging Face paper pages before DOM extraction. This keeps the title/site/date metadata and the paper/link/citation blocks while dropping header/footer/hydration chrome.node-html-parsertraverses the tree once instead of once per tag.<main>and does not pick up surrounding chrome.Verification
npm run typechecknpx vitest run --exclude '.claude/**'— 18 files, 146 tests2611.08175) moved from 5.33ms to 4.87ms median.pr-25-7fad10eagainst production D1:2611.02857→200, 10 blocks, 0.88s2611.05036→200, 12 blocks, 0.72s2611.06741→200, 20 blocks, 0.97snpm run db:migrate:localwrangler deploy --dry-runNotes
exceededCpufor HF URLs, the next lever is the paper Markdown-content endpoint or a stored-summary fallback; both trade away the HF citation/link extraction.🤖 Generated with Claude Code