mui / mui/material-ui

[autocomplete] renderOption is extremely slow

Open
#34,712 21 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance ready to take scope: autocomplete
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Steps to reproduce 🕹

Go to this sandbox: https://stackblitz.com/edit/react-nv8116-okqafc?file=demo.tsx

Steps:

  1. Have more than 500+ entries as Autocomplete options
  2. Expand the dropdown or start typing anything
  3. Observe the extreme lag on expand or when typing/deleting the first letter
Current behavior 😯

Extreme lag when Autocomplete is using renderOption with somewhat "large" entries.

Expected behavior 🤔

Expect it to not lag... or at least for things as little as under 1-2000 entries, it shouldn't be that bad.

Context 🔦

There is another ticket trying to resolve this issue but it looks like the changes to the virtualization never got merged into any release?

https://github.com/mui/material-ui/issues/25417

The merged fix seems to be only address the documentation (based on the title).

I don't think renderOption should be re-rendering everything from scratch on every operations (expand, keypress)?

Your environment 🌎

See sandbox.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz sandbox and its demo.tsx to reproduce the lag with 500+ Autocomplete options and renderOption. Read issue #25417 for the referenced virtualization context; done means expanding and typing or deleting in the dropdown no longer causes extreme lag for roughly 1,000–2,000 entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.