-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix(application-generic): potential get preferences performance improvement #7467
fix(application-generic): potential get preferences performance improvement #7467
Conversation
✅ Deploy Preview for dev-web-novu ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for dashboard-v2-novu-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
const workflowPreferences: ISubscriberPreferenceResponse[] = | ||
this.calculateWorkflowPreferences( | ||
workflowList, | ||
workflowPreferenceSets, | ||
subscriberGlobalPreference, | ||
command.includeInactiveChannels, | ||
); | ||
|
||
const nonCriticalWorkflowPreferences = workflowPreferences.filter( | ||
(preference) => !preference.template.critical, | ||
); | ||
|
||
return nonCriticalWorkflowPreferences; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all I did in this file is moved the code parts to the class functions to be able to instrument them and see the perf bottleneck
const mergedPreferences = deepMerge( | ||
preferencesList as DeepRequired<PreferencesEntity>[], | ||
); | ||
const mergedPreferences = merge({}, ...preferencesList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We assume that the potential issue of slow response times could be that we used the custom deepMerge
code that was copied from the lib and had not been maintained for the last 2 years. We want to verify that assumption.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LetItRock Nice!
If the hypothesis is verified we should do a follow up PR, and remove the deepMerge utility from the code base as it's used in two more occasions.
@@ -1,9 +1,8 @@ | |||
import { merge } from 'lodash'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For 100% manual tree shaking
import { merge } from 'lodash'; | |
import merge from 'lodash/merge'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh yeah missed that
What changed? Why was the change needed?
Get subscriber preferences potential perf improvement.
Screenshots