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

Lazily calculate the hash #130

Merged

Conversation

eldar-gamisoniya
Copy link
Contributor

We had the following use-case: around 70 feature flags, most of which are either fully turned on or off.

Because md5 hash is calculated for every feature flag, getIdentityFlags with local evaluation ended up taking 30-40ms.

The pr lazily calls getHashedPercentateForObjIds only when needed, and skips it for cases when it's not necessary (0 and 100%). With the patch getIdentityFlags executes in ~3ms.

Please let me know if something is missing or needs changing. Have a nice day!

@dabeeeenster
Copy link
Contributor

Surprised that calculating these hashes takes so long! Thanks for the PR - will take a look.

@matthewelwell matthewelwell merged commit 53f9f57 into Flagsmith:main Aug 7, 2023
@eldar-gamisoniya eldar-gamisoniya deleted the impr/lazy-percentage-value branch August 7, 2023 12:25
@eldar-gamisoniya
Copy link
Contributor Author

eldar-gamisoniya commented Aug 7, 2023

Btw, is there a timeline for publishing a new version?

PS. I see that the last published version is 3.0.1 but there was a bump to 3.1.0 recently: #129, am I right to assume this is unintentional?

@dabeeeenster
Copy link
Contributor

OK 3.10.0 released - thanks!

beeme1mr referenced this pull request in open-feature/playground Dec 6, 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 |
|---|---|---|---|---|---|
| [flagsmith-nodejs](http://flagsmith.com/)
([source](https://togithub.com/Flagsmith/flagsmith-nodejs-client)) |
[`^2.5.0` ->
`^3.0.0`](https://renovatebot.com/diffs/npm/flagsmith-nodejs/2.5.2/3.2.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/flagsmith-nodejs/3.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/flagsmith-nodejs/3.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/flagsmith-nodejs/2.5.2/3.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/flagsmith-nodejs/2.5.2/3.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>Flagsmith/flagsmith-nodejs-client (flagsmith-nodejs)</summary>

###
[`v3.2.0`](https://togithub.com/Flagsmith/flagsmith-nodejs-client/releases/tag/v3.2.0):
Version 3.2.0

[Compare
Source](https://togithub.com/Flagsmith/flagsmith-nodejs-client/compare/v3.1.1...v3.2.0)

#### What's Changed

- feat: offline-mode by
[@&#8203;novakzaballa](https://togithub.com/novakzaballa) in
[https://github.com/Flagsmith/flagsmith-nodejs-client/pull/136](https://togithub.com/Flagsmith/flagsmith-nodejs-client/pull/136)

**Full Changelog**:
Flagsmith/flagsmith-nodejs-client@v3.1.1...v3.2.0

###
[`v3.1.1`](https://togithub.com/Flagsmith/flagsmith-nodejs-client/releases/tag/v3.1.1):
Version 3.1.1

[Compare
Source](https://togithub.com/Flagsmith/flagsmith-nodejs-client/compare/v3.1.0...v3.1.1)

#### What's Changed

- fix: Default requestTimeout by
[@&#8203;novakzaballa](https://togithub.com/novakzaballa) in
[https://github.com/Flagsmith/flagsmith-nodejs-client/pull/133](https://togithub.com/Flagsmith/flagsmith-nodejs-client/pull/133)

**Full Changelog**:
Flagsmith/flagsmith-nodejs-client@v3.1.0...v3.1.1

###
[`v3.1.0`](https://togithub.com/Flagsmith/flagsmith-nodejs-client/releases/tag/v3.1.0):
Version 3.1.0

[Compare
Source](https://togithub.com/Flagsmith/flagsmith-nodejs-client/compare/v3.0.1...v3.1.0)

#### What's Changed

- Add 10 secs by default to requestTimeoutSeconds by
[@&#8203;novakzaballa](https://togithub.com/novakzaballa) in
[https://github.com/Flagsmith/flagsmith-nodejs-client/pull/128](https://togithub.com/Flagsmith/flagsmith-nodejs-client/pull/128)
- Bump version to 3.1.0 by
[@&#8203;novakzaballa](https://togithub.com/novakzaballa) in
[https://github.com/Flagsmith/flagsmith-nodejs-client/pull/129](https://togithub.com/Flagsmith/flagsmith-nodejs-client/pull/129)
- Bump word-wrap from 1.2.3 to 1.2.4 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/Flagsmith/flagsmith-nodejs-client/pull/127](https://togithub.com/Flagsmith/flagsmith-nodejs-client/pull/127)
- Bump tough-cookie from 4.0.0 to 4.1.3 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/Flagsmith/flagsmith-nodejs-client/pull/125](https://togithub.com/Flagsmith/flagsmith-nodejs-client/pull/125)
- Lazily calculate the hash by
[@&#8203;eldar-gamisoniya](https://togithub.com/eldar-gamisoniya) in
[https://github.com/Flagsmith/flagsmith-nodejs-client/pull/130](https://togithub.com/Flagsmith/flagsmith-nodejs-client/pull/130)

#### New Contributors

- [@&#8203;novakzaballa](https://togithub.com/novakzaballa) made their
first contribution in
[https://github.com/Flagsmith/flagsmith-nodejs-client/pull/128](https://togithub.com/Flagsmith/flagsmith-nodejs-client/pull/128)
- [@&#8203;eldar-gamisoniya](https://togithub.com/eldar-gamisoniya) made
their first contribution in
[https://github.com/Flagsmith/flagsmith-nodejs-client/pull/130](https://togithub.com/Flagsmith/flagsmith-nodejs-client/pull/130)

**Full Changelog**:
Flagsmith/flagsmith-nodejs-client@v3.0.1...v3.1.0

###
[`v3.0.1`](https://togithub.com/Flagsmith/flagsmith-nodejs-client/releases/tag/v3.0.1):
Version 3.0.1

[Compare
Source](https://togithub.com/Flagsmith/flagsmith-nodejs-client/compare/v3.0.0...v3.0.1)

#### What's Changed

- Fix deploy action by [@&#8203;kyle-ssg](https://togithub.com/kyle-ssg)
in
[https://github.com/Flagsmith/flagsmith-nodejs-client/pull/121](https://togithub.com/Flagsmith/flagsmith-nodejs-client/pull/121)
- Bump semver from 7.3.7 to 7.5.2 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/Flagsmith/flagsmith-nodejs-client/pull/122](https://togithub.com/Flagsmith/flagsmith-nodejs-client/pull/122)

**Full Changelog**:
Flagsmith/flagsmith-nodejs-client@v3.0.0...v3.0.1

###
[`v3.0.0`](https://togithub.com/Flagsmith/flagsmith-nodejs-client/releases/tag/v3.0.0):
Version 3.0.0

[Compare
Source](https://togithub.com/Flagsmith/flagsmith-nodejs-client/compare/v2.5.2...v3.0.0)

#### What's Changed

- **BREAKING CHANGE**: Ensure percentage split evaluations are
consistent by
[@&#8203;matthewelwell](https://togithub.com/matthewelwell) in
[https://github.com/Flagsmith/flagsmith-nodejs-client/pull/119](https://togithub.com/Flagsmith/flagsmith-nodejs-client/pull/119)

WARNING: We modified the local evaluation behaviour. You may see
different flags returned to identities attributed to your percentage
split-based segments after upgrading to this version.

**Full Changelog**:
Flagsmith/flagsmith-nodejs-client@v2.5.2...v3.0.0

</details>

---

### Configuration

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

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, 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/open-feature/playground).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMzEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjgxLjMiLCJ0YXJnZXRCcmFuY2giOiJtYWluIn0=-->

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.

3 participants