Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing NPM registry is slow #2

Closed
mxdvl opened this issue Jan 25, 2023 · 0 comments
Closed

Parsing NPM registry is slow #2

mxdvl opened this issue Jan 25, 2023 · 0 comments

Comments

@mxdvl
Copy link
Contributor

mxdvl commented Jan 25, 2023

I ran some numbers, which is how I settled on using unpkg.com, as some packges are absolutely huuuuge (looking at you @typescript-eslint/eslint-plugin ~ 75MB)

Parsing an object with the following shape is quite expensive:

interface Package {
	name: string;
	versions: Record<string, {
		name: string;
		dependencies: Record<string, string>;
		/* etc. */
	}>
}
cpu: Apple M1 Max
runtime: deno 1.29.4 (aarch64-apple-darwin)

file:///Users/max_duval/Code/deno-playground/actions-npm-dependencies/src/registry.bench.ts
benchmark                        time (avg)             (min … max)       p75       p99      p995
------------------------------------------------------------------- -----------------------------
Parsing versions natively     95.97 µs/iter    (77.92 µs … 1.07 ms) 102.46 µs 143.08 µs 162.62 µs
Parsing versions as unknown  324.37 µs/iter (298.62 µs … 732.83 µs) 319.04 µs 634.83 µs 652.12 µs
Parsing versions as package    1.86 ms/iter     (1.78 ms … 2.42 ms)   1.86 ms   2.22 ms   2.33 ms

Accessing package.json for specific versions on unpkg is a lot faster:

@mxdvl mxdvl closed this as completed Jan 25, 2023
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

No branches or pull requests

1 participant