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

expensive blocking PSL lookup #239

Closed
jjason685 opened this issue May 5, 2022 · 2 comments · Fixed by #346
Closed

expensive blocking PSL lookup #239

jjason685 opened this issue May 5, 2022 · 2 comments · Fixed by #346
Assignees

Comments

@jjason685
Copy link

jjason685 commented May 5, 2022

return psl.get(domain);

at high throughputs, PSL lookups can be quite intensive. for example, with 1000 calls to psl.get, this can take 400 milliseconds, and completely blocks the event loop. this seems to relatively linearly scale with more calls.

a recommendation is to use a simple Map cache; for example,

return psl.get(domain);

would be transformed to

if (!cache.has(domain)) {
   cache.set(domain, psl.get(domain));
}

return cache.get(domain);

(with cache initialized at the top as a new Map).

As the psl.get results are static, this would only benefit the performance, with no drawbacks.

@colincasey
Copy link
Contributor

@jjason685 thanks for reporting this. We'll look into adding a cache around the PSL lookup as you suggested.

@isaacl
Copy link

isaacl commented Dec 5, 2023

See #338 for a more explicit request

colincasey added a commit that referenced this issue Dec 13, 2023
One of the topics that came up in discussions for v5 was considering replacements for `psl` (see #255). This PR replaces that library with `tldts` which is more performant.

Fixes #239
Fixes #338
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 a pull request may close this issue.

3 participants