Skip to content
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

[Perf] Improved performance for useActivityTreeWithRenderer #5163

Merged
merged 14 commits into from
May 8, 2024

Conversation

compulim
Copy link
Contributor

@compulim compulim commented May 3, 2024

Fixes #5162.

Changelog Entry

Fixed

Description

useActivityTreeWithRenderer slowdown exponentially. We are working on the bin logics.

New tests added are not in our test suite yet as we are still exploring how to write performance tests.

Note: the total time needed to render the chat history is not changed significantly.

Design

Today, we are using [].find(entry => entry.activity === activity) to find an entry.

We are building a temporary Map so we can use indexing to achieve higher performance, Map.get(activity).

Before

At 3th activity:

image

At 197th activity:

image

After

At 3th activity:

image

At 197th activity:

image

Specific Changes

  • Updated bin logic in useActivityTreeWithRenderer to use Map
  • Removed extraneous accessibility check in local test browser
  • Added skipWait option in Direct Line Emulator
  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

@compulim compulim marked this pull request as ready for review May 3, 2024 19:07
tdurnford
tdurnford previously approved these changes May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Perf] useActivityTreeWithRenderer slowdown exponentially
3 participants