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(vary): use word character inside regex character class #270

Merged
merged 1 commit into from
Sep 16, 2023

Conversation

Fdawgs
Copy link
Member

@Fdawgs Fdawgs commented Sep 16, 2023

Checklist

@Fdawgs Fdawgs changed the title refactor(vary): use word character refactor(vary): use word character inside regex character class Sep 16, 2023
@Fdawgs Fdawgs marked this pull request as draft September 16, 2023 06:56
@Fdawgs
Copy link
Member Author

Fdawgs commented Sep 16, 2023

Throwing this into a draft for now. @Uzlopak I noticed you've been making regex improvements in Node itself (nodejs/node#49643), do you know if using a \w character over [a-zA-Z0-9_] impacts performance at all?

@Uzlopak
Copy link
Contributor

Uzlopak commented Sep 16, 2023

Tbh i never benched it. And i have no clue if it could have an impact. I mean theoretically \w gets just translated to the specific chars internally. But maybe the regex engine optimizes it somehow.

But on the other hand i never used \w because like 10 years ato I always needed to lookup if i am not mistaking it with \W :))).

@Fdawgs
Copy link
Member Author

Fdawgs commented Sep 16, 2023

Just used the benchmark in benchmark/vary.js

master:
image

PR:

image

@Fdawgs Fdawgs marked this pull request as ready for review September 16, 2023 13:22
Copy link
Contributor

@Uzlopak Uzlopak left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit 120a209 into master Sep 16, 2023
17 checks passed
@Uzlopak Uzlopak deleted the Fdawgs-patch-1 branch September 16, 2023 14:51
renovate bot referenced this pull request in tomacheese/telcheck Sep 19, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@fastify/cors](https://togithub.com/fastify/fastify-cors) | [`8.3.0`
->
`8.4.0`](https://renovatebot.com/diffs/npm/@fastify%2fcors/8.3.0/8.4.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@fastify%2fcors/8.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@fastify%2fcors/8.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@fastify%2fcors/8.3.0/8.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@fastify%2fcors/8.3.0/8.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>fastify/fastify-cors (@&#8203;fastify/cors)</summary>

###
[`v8.4.0`](https://togithub.com/fastify/fastify-cors/releases/tag/v8.4.0)

[Compare
Source](https://togithub.com/fastify/fastify-cors/compare/v8.3.0...v8.4.0)

#### What's Changed

- fix documentation, onRequest is default lifecycle stage by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[https://github.com/fastify/fastify-cors/pull/254](https://togithub.com/fastify/fastify-cors/pull/254)
- perf(index): use spread over `Object.assign()` by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[https://github.com/fastify/fastify-cors/pull/257](https://togithub.com/fastify/fastify-cors/pull/257)
- docs(readme): add plugin compatibility table by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[https://github.com/fastify/fastify-cors/pull/258](https://togithub.com/fastify/fastify-cors/pull/258)
- test: cors headers sent when payload is stream by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[https://github.com/fastify/fastify-cors/pull/260](https://togithub.com/fastify/fastify-cors/pull/260)
- Reduce bundle size by
[@&#8203;timedtext](https://togithub.com/timedtext) in
[https://github.com/fastify/fastify-cors/pull/266](https://togithub.com/fastify/fastify-cors/pull/266)
- chore(deps-dev): bump
[@&#8203;typescript-eslint/eslint-plugin](https://togithub.com/typescript-eslint/eslint-plugin)
from 5.62.0 to 6.4.1 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/fastify/fastify-cors/pull/267](https://togithub.com/fastify/fastify-cors/pull/267)
- chore(deps-dev): bump tsd from 0.28.1 to 0.29.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/fastify/fastify-cors/pull/268](https://togithub.com/fastify/fastify-cors/pull/268)
- test: use `node:` prefix to bypass require.cache call for builtins by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[https://github.com/fastify/fastify-cors/pull/269](https://togithub.com/fastify/fastify-cors/pull/269)
- refactor(vary): use word character inside regex character class by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[https://github.com/fastify/fastify-cors/pull/270](https://togithub.com/fastify/fastify-cors/pull/270)

#### New Contributors

- [@&#8203;timedtext](https://togithub.com/timedtext) made their first
contribution in
[https://github.com/fastify/fastify-cors/pull/266](https://togithub.com/fastify/fastify-cors/pull/266)

**Full Changelog**:
fastify/fastify-cors@v8.3.0...v8.4.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/tomacheese/telcheck).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi45Ny4xIiwidXBkYXRlZEluVmVyIjoiMzYuOTcuMSIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
bodinsamuel referenced this pull request in specfy/specfy Nov 22, 2023
[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@fastify/cors](https://togithub.com/fastify/fastify-cors) | [`8.3.0`
->
`8.4.1`](https://renovatebot.com/diffs/npm/@fastify%2fcors/8.3.0/8.4.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@fastify%2fcors/8.4.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@fastify%2fcors/8.4.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@fastify%2fcors/8.3.0/8.4.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@fastify%2fcors/8.3.0/8.4.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>fastify/fastify-cors (@&#8203;fastify/cors)</summary>

###
[`v8.4.1`](https://togithub.com/fastify/fastify-cors/releases/tag/v8.4.1)

[Compare
Source](https://togithub.com/fastify/fastify-cors/compare/v8.4.0...v8.4.1)

#### What's Changed

- Fix type of OriginCallback by
[@&#8203;ken-browning](https://togithub.com/ken-browning) in
[https://github.com/fastify/fastify-cors/pull/272](https://togithub.com/fastify/fastify-cors/pull/272)
- test: add `u` unicode flag to regex by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[https://github.com/fastify/fastify-cors/pull/273](https://togithub.com/fastify/fastify-cors/pull/273)
- chore(package): explicitly declare js module type by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[https://github.com/fastify/fastify-cors/pull/274](https://togithub.com/fastify/fastify-cors/pull/274)
- test(index): replace `typeof` undefined check by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[https://github.com/fastify/fastify-cors/pull/275](https://togithub.com/fastify/fastify-cors/pull/275)

#### New Contributors

- [@&#8203;ken-browning](https://togithub.com/ken-browning) made their
first contribution in
[https://github.com/fastify/fastify-cors/pull/272](https://togithub.com/fastify/fastify-cors/pull/272)

**Full Changelog**:
fastify/fastify-cors@v8.4.0...v8.4.1

###
[`v8.4.0`](https://togithub.com/fastify/fastify-cors/releases/tag/v8.4.0)

[Compare
Source](https://togithub.com/fastify/fastify-cors/compare/v8.3.0...v8.4.0)

#### What's Changed

- fix documentation, onRequest is default lifecycle stage by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[https://github.com/fastify/fastify-cors/pull/254](https://togithub.com/fastify/fastify-cors/pull/254)
- perf(index): use spread over `Object.assign()` by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[https://github.com/fastify/fastify-cors/pull/257](https://togithub.com/fastify/fastify-cors/pull/257)
- docs(readme): add plugin compatibility table by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[https://github.com/fastify/fastify-cors/pull/258](https://togithub.com/fastify/fastify-cors/pull/258)
- test: cors headers sent when payload is stream by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[https://github.com/fastify/fastify-cors/pull/260](https://togithub.com/fastify/fastify-cors/pull/260)
- Reduce bundle size by
[@&#8203;timedtext](https://togithub.com/timedtext) in
[https://github.com/fastify/fastify-cors/pull/266](https://togithub.com/fastify/fastify-cors/pull/266)
- chore(deps-dev): bump
[@&#8203;typescript-eslint/eslint-plugin](https://togithub.com/typescript-eslint/eslint-plugin)
from 5.62.0 to 6.4.1 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/fastify/fastify-cors/pull/267](https://togithub.com/fastify/fastify-cors/pull/267)
- chore(deps-dev): bump tsd from 0.28.1 to 0.29.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/fastify/fastify-cors/pull/268](https://togithub.com/fastify/fastify-cors/pull/268)
- test: use `node:` prefix to bypass require.cache call for builtins by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[https://github.com/fastify/fastify-cors/pull/269](https://togithub.com/fastify/fastify-cors/pull/269)
- refactor(vary): use word character inside regex character class by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[https://github.com/fastify/fastify-cors/pull/270](https://togithub.com/fastify/fastify-cors/pull/270)

#### New Contributors

- [@&#8203;timedtext](https://togithub.com/timedtext) made their first
contribution in
[https://github.com/fastify/fastify-cors/pull/266](https://togithub.com/fastify/fastify-cors/pull/266)

**Full Changelog**:
fastify/fastify-cors@v8.3.0...v8.4.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 4pm every weekday" in timezone
Europe/Paris, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/specfy/specfy).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6ImNob3JlL3Jlbm92YXRlQmFzZUJyYW5jaCJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

4 participants