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

rewrite the entire module #80

Merged
merged 2 commits into from
Mar 9, 2021
Merged

rewrite the entire module #80

merged 2 commits into from
Mar 9, 2021

Conversation

nlf
Copy link
Contributor

@nlf nlf commented Mar 3, 2021

this module was pretty slow based on the usage of regular expressions, unnecessary loops, and even a custom string templating engine.

more importantly than that, it was also difficult to read, difficult to add tests, and difficult to debug.

this rewrite eliminates all of that.

based on #79 which was the test-only refactor, definitely review and land that first

@nlf nlf force-pushed the nlf/rewrite branch 2 times, most recently from 446aeda to a090eeb Compare March 3, 2021 20:51
all internals have been rewritten to maintain a similar contract but to remove
excessive use of regular expressions, unnecessary loops, the custom string
templating engine, and various other bits of complexity

BREAKING CHANGE extending with custom providers has changed
@fregante
Copy link
Contributor

fregante commented Mar 3, 2021

I'm not a maintainer here, but I suggest proving that this code is actually better than before (i.e. disable the cache and run some benchmarks)

@nlf
Copy link
Contributor Author

nlf commented Mar 4, 2021

The existing code is buggy and hard to read. There are performance gains but those are secondary to making the code maintainable, which is the real intent here. Benchmarking this in a meaningful way is tricky because while on average the performance gains are modest (0.5-1ms per url) those gains across an entire package tree add up, and there is the unmeasured win of no longer being susceptible to regular expression denial of service attacks

@wraithgar wraithgar changed the base branch from latest to add-github-http March 9, 2021 18:22
@wraithgar wraithgar changed the base branch from add-github-http to latest March 9, 2021 18:23
package.json Outdated Show resolved Hide resolved
@ljharb
Copy link

ljharb commented May 6, 2021

There's no changelog entries - what are the breaking changes here?

@nlf
Copy link
Contributor Author

nlf commented May 6, 2021

the breaking change was in how external providers are declared, the changes to test/localhost.js are the relevant ones there. nothing else was breaking.

@ljharb
Copy link

ljharb commented May 6, 2021

Thanks. could the changelog get entries added for v4+?

@wraithgar wraithgar deleted the nlf/rewrite branch September 21, 2021 14:22
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.

None yet

5 participants