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

perf: call cacheKeyFn only when it is needed (if caching) #342

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abendi
Copy link

@abendi abendi commented Jun 9, 2023

Previously cacheKeyFn was called unnecessarily with caching disabled as cacheKey was never used in such case. This PR makes sure cacheKeyFn is called only when caching is enabled and cacheKey is actually needed. Sometimes cacheKeyFn can use more expensive code, such as JSON.stringify, in which case it is preferred not to waste CPU cycles.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 9, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: abendi / name: Arvo Bendi (965c884)

@saihaj saihaj requested a review from ardatan June 12, 2023 00:48
@abendi abendi changed the title perf: call and reuse cacheKeyFn only when it is needed (if caching) perf: call cacheKeyFn only when it is needed (if caching) Jun 13, 2023
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

1 participant