Skip to content

test: add benchmark script for parsing 23104 URLs - #244

Draft
jhnns wants to merge 4 commits into
mainfrom
parse-5776-urls-timing-test
Draft

test: add benchmark script for parsing 23104 URLs#244
jhnns wants to merge 4 commits into
mainfrom
parse-5776-urls-timing-test

Conversation

@jhnns

@jhnns jhnns commented Aug 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds src/scripts/bench-parse-urls.ts, a benchmark script that generates 23104 synthetic URLs (varying subdomains/TLDs/paths) and measures fromUrl() + parseDomain() throughput using performance.now().
  • Warms up the lazily-parsed trie before timing so the one-time parse cost isn't included in the measurement.

Test plan

  • Run npm run build then node ./dist/scripts/bench-parse-urls.js and confirm it prints total and average parse time.

jhnns and others added 2 commits August 20, 2026 18:10
Generates 5776 synthetic URLs and measures fromUrl()/parseDomain() throughput.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jhnns jhnns changed the title test: add benchmark script for parsing 5776 URLs test: add benchmark script for parsing 23104 URLs Aug 20, 2026
@jhnns jhnns mentioned this pull request Aug 20, 2026
jhnns and others added 2 commits August 20, 2026 22:26
Extracts the url1/url2 values (11552 total, duplicates included) from
url-relation's test fixture and measures fromUrl()/parseDomain()
throughput on real-world-shaped URLs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
readFileSync()'d assets aren't copied into dist/ by tsc, so the
compiled benchmark script failed at runtime. Importing the JSON with
an import attribute makes tsc emit it alongside the compiled script.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Aug 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/parse-domain@244

commit: 7a614b1

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 95.094%. remained the same — parse-5776-urls-timing-test into main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants