firefox-devtools / firefox-devtools/profiler
Do an audit of the memoization of the selectors.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 491
- Avg merge
- 3d 46m
- Merged PRs (30d)
- 27
Description
**Update:** I renamed this issue to be more general, as this specific memoization tweak may not work, but the general principle stands.
**Original post:**
The selectors have a decent amount of churn as the symbolication information comes in. Not all derived data needs to be recomputed based off of new symbols. I found this especially true when computing stack timing by depth.
Something along the lines of this may work:
```js
import { createSelector, createSelectorCreator, defaultMemoize } from 'reselect';
export const getProfile = state => getProfileView(state).profile;
export getInitialProfile = createSelectorCreator(
defaultMemoize,
profile => 'threads' in profile
)(
getProfile,
// Memoize off of the profile here.
profile => profile
);
```
┆Issue is synchronized with this [Jira Task](https://mozilla-hub.atlassian.net/browse/FP-70)
Contributor guide
Assessment
This issue has not been assessed yet.