microsoft / microsoft/BotFramework-WebChat
Performance: <BasicTranscript> should use useMemoArrayMap() to memoize the result
Open
Nobody has claimed this yet.
backlog
feature-request
- Dominant language
- HTML
- Stars
- 1.8k
- Forks
- 1.6k
- Avg merge
- 22h 58m
- Merged PRs (30d)
- 2
Description
Feature Request
Note: the performance gain here is minimal. Reducing a O(n) of object creation/destruction on every incoming/outgoing activity.
Excerpt from the code.
// TODO: [P2] We can also use useMemoArrayMap() for this function.
// useMemoArrayMap(array, mapper) will need to be modified to useMemoArrayMap(array, mapper, getDeps).
// This is because the deps for every item is not itself anymore. It will include activityElements[index + 1].
const activityElementsWithMetadata = useMemo(
)
Implementation
- Modify
useMemoArrayMap(array, mapper)- Change it to
useMemoArrayMap(array, mapper, getDeps = (item, index) => [item]) getDepsallow the mapper to cache the per-item deps- Modify
prevResult = prevMapperCalls.find()to look for an array ofdeps, instead ofvalue
- Change it to
[Enhancement]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating useMemoArrayMap and the implementation, then read how the current activityElementsWithMetadata memoization works. Update the utility to accept per-item dependencies and apply it to the transcript mapping; done means the requested memoization path is used without changing the resulting metadata.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100