[FSSDK-11787] fix config parsing performance#1080
Merged
Conversation
b56cb36 to
b168a1e
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes the performance of config parsing by improving how the variationIdMap is populated. Instead of creating new objects through spread operations for each experiment, it modifies the keyBy utility function to accept an optional base object parameter and directly mutates it.
- Modified
keyByfunction to accept an optional base object parameter and mutate it directly - Removed the now-unused
keyByUtilhelper function - Updated all
variationIdMappopulation calls to use the more efficient in-place approach
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/utils/fns/index.ts | Enhanced keyBy function with optional base parameter and removed keyByUtil |
| lib/utils/fns/index.spec.ts | Updated test to use keyBy instead of removed keyByUtil |
| lib/project_config/project_config.ts | Replaced spread operations with direct mutation calls for performance |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
raju-opti
added a commit
that referenced
this pull request
Sep 2, 2025
Currently, variationIdMap is being populated as follows:
```
projectConfig.variationIdMap = {
...projectConfig.variationIdMap,
...keyBy(experiment.variations, 'id')
};
```
This creates a new objects for each experiment unnecessarily. This causes large slowdown in project config parsing for datafiles containing a large number of experiments containing a large number of variations.
This commit makes this more efficient.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Currently, variationIdMap is being populated as follows:
This creates a new objects for each experiment unnecessarily. This causes large slowdown in project config parsing for datafiles containing a large number of experiments containing a large number of variations.
This PR makes this more efficient.
Test plan
Issues