Skip to content

fix: performance improvement - #53

Merged
phated merged 4 commits into
gulpjs:mainfrom
Trott:perf
Sep 29, 2021
Merged

phated merged 4 commits into
gulpjs:mainfrom
Trott:perf

Conversation

@Trott

@Trott Trott commented Sep 29, 2021

Copy link
Copy Markdown
Contributor

The performance measuring here is confounded a bit by an is-glob performance gotcha that is fixed in micromatch/is-glob#15. Here's what I'm seeing running time node -e "require('./')('/('.repeat(500000) + ')')" on my 2013 Macbook:

  • main branch with is-glob 4.0.2: No idea. I sent SIGINT after 12 minutes so more than that, and probably a lot more than that.
  • this PR with is-glob 4.0.2: 6.52 seconds
  • this PR with aforementioned is-glob PR: 80 milliseconds

(The added test will likely fail without the is-glob PR, depending on how performant the test machine is.)

@Trott

Trott commented Sep 29, 2021

Copy link
Copy Markdown
Contributor Author

The tests are failing because performance with the newly-added test is not good enough without the additional help of the is-glob update in micromatch/is-glob#15.

Comment thread index.js
if (/[^\\][{[]/.test(str)) {
return true;
}
return isGlob(str);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there anything weird (different?) by changing the order of the isGlob check and "globby" regexp test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because they were OR'ed, I don't think it makes any difference logically. I'm happy to flip it back assuming that doesn't introduce performance regressions.

@phated

phated commented Sep 29, 2021

Copy link
Copy Markdown
Member

@Trott can you update the package.json to require is-glob 4.0.3? 🍻

@Trott

Trott commented Sep 29, 2021

Copy link
Copy Markdown
Contributor Author

@Trott can you update the package.json to require is-glob 4.0.3? 🍻

Done.

@Trott

Trott commented Sep 29, 2021

Copy link
Copy Markdown
Contributor Author

All green! ✅

Comment thread package.json Resolved
@phated
phated merged commit 843f8de into gulpjs:main Sep 29, 2021
@phated

phated commented Sep 29, 2021

Copy link
Copy Markdown
Member

Published as 6.0.2 - thanks a ton @Trott!

@Trott
Trott deleted the perf branch September 30, 2021 00:41
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.

2 participants