firefox-devtools / firefox-devtools/profiler

Do an audit of the memoization of the selectors.

Open
#132 2 comments 0 reactions 0 assignees View on GitHub
code maintenance perf
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.