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

refactor(resolve-dependencies): remove ramda isEmpty usages #6753

Merged
merged 3 commits into from
Jul 2, 2023

Conversation

zxbodya
Copy link
Contributor

@zxbodya zxbodya commented Jul 2, 2023

Replacing usages of Ramda isEmpty with alternatives.

To my surprise - I have discovered that it is really slow.
(it looks like because of allowing too many possible input types, it does a lot of unnecessary work).

before:
Screenshot 2023-07-02 at 16 57 26

after:
Screenshot 2023-07-02 at 17 01 33

that is around 15%, faster by just not using it

@zxbodya zxbodya requested a review from zkochan as a code owner July 2, 2023 15:04
@@ -120,7 +119,7 @@ function toLockfileDependency (
if (opts.depPath[0] !== '/' && !pkg.id.endsWith(opts.depPath)) {
result['id'] = pkg.id
}
if (!isEmpty(pkg.peerDependencies ?? {})) {
if (Object.keys(pkg.peerDependencies ?? {}).length !== 0) {
Copy link
Member

Choose a reason for hiding this comment

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

maybe just > 0?

it is 2 chars less

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated the PR, do not really have preference on this

@zkochan zkochan merged commit 9b51108 into pnpm:main Jul 2, 2023
8 checks passed
@zxbodya zxbodya deleted the perf-rambda-isEpmty branch July 2, 2023 20:12
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

2 participants