plugins icon indicating copy to clipboard operation
plugins copied to clipboard

perf: replace startsWith with strict equality

Open btea opened this issue 2 months ago • 2 comments

Rollup Plugin Name: {name}

This PR contains:

  • [ ] bugfix
  • [ ] feature
  • [ ] refactor
  • [ ] documentation
  • [x] other

Are tests included?

  • [ ] yes (bugfixes and features will not be merged without tests)
  • [x] no

Breaking Changes?

  • [ ] yes (breaking changes will not be merged unless absolutely necessary)
  • [x] no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

Description

When determining the value of the first letter of a string, using strict equality is more efficient than startsWith. refer to link

btea avatar Oct 05 '25 02:10 btea

As always thanks for the PR. I'm not going to approve this, however. It's a micro-optimization at the expense of readability with no clear advantage that any typical user will realize.

shellscape avatar Oct 05 '25 11:10 shellscape

Yes, this is a very limited modification unless there is extensive triggering logic. Feel free to turn it off, thanks for the review.

btea avatar Oct 05 '25 13:10 btea