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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance: 馃殌 Change ParseUrl to use LRUCache #13892

Merged
merged 5 commits into from Mar 15, 2018

Conversation

cjdeleon62
Copy link

Improves the performance of ParseUrl by allowing the function to keep track of the urls using an LRU cache with a max capacity of 100.

issue : #13280

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

馃摑 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers
  • Your company has a Point of Contact who decides which employees are authorized to participate. Ask your POC to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • The email used to register you as an authorized contributor must be the email used for the Git commit. Check your existing CLA data and verify that your email is set on your git commits.
  • The email used to register you as an authorized contributor must also be attached to your GitHub account.

@cjdeleon62
Copy link
Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

Copy link
Contributor

@aghassemi aghassemi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cjdeleon62 Excellent PR! Just a small request before we merge.

const a1 = parseUrl(url);
// cache 99 more urls in order to reach max capacity of LRU cache: 100
for (let i = 0; i < 100; i++) {
parseUrl(`${url}-${i}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expecting result of parseUrl to be same as a1 would be a nice addition to ensure cache part is working as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aghassemi Ah right, that definitely makes sense. I'll add that in

@cjdeleon62 cjdeleon62 force-pushed the enhance/LRU-cache branch 2 times, most recently from cef8cd2 to 06d9b97 Compare March 15, 2018 04:28
@cjdeleon62
Copy link
Author

@aghassemi wondering if you can review the changes I made after your comments 馃槂

@aghassemi
Copy link
Contributor

LGTM, Merged. Thanks for contributing @cjdeleon62!

@aghassemi aghassemi merged commit 0dd1ae7 into ampproject:master Mar 15, 2018
@cjdeleon62
Copy link
Author

@aghassemi thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants