question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

very bad performance when rendering array of 250elements

See original GitHub issue

I am using component like this:

{{#power-select
  options=countries
  searchField="name"
  placeholder="Click to select country"
  searchPlaceholder="Type to filter..."
  selectedItemComponent="country-badge/selected"
  selected=billingCountry
  onchange=(action (mut billingCountry))
  as |country|
}}
  <img src="/assets/img/country-flags/{{country.code}}.svg" class="icon-flag">
  <span>{{country.name}}</span>
{{/power-select}}

When I click on it, it takes around 1second to show the list. Hovering on different countries is very slow as well. Initial rendering takes around half a second.

Do you have any ideas how can I improve performance, because 250 items should be very fast to render?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
cibernoxcommented, Jan 18, 2017

Having the list in the background is better in this scenario (hundreds of options), but also much worse other scenarios.

For now the only thing I recommend is keep the number of items in a manageable size, and if it’s too big don’t display any items and allow users to type. Showing a “Loading” mesage is possible as you mention is possible tho. You have to make the options a promise

I’ll work on making the options faster, and ember itself is becoming faster at rendering {{each}}, but I can’t give you a time.

1reaction
cibernoxcommented, Jan 11, 2017

Actually, thanks to this i’ve discovered that performance degrades when hovering over long lists. At the beginning every hover is a few ms but as i keep overing it stats to be slower and slower until it takes ~200ms.

There is some kind of leakage there. I’ll investigate it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Performance problems with long array lists in the React state
This procedure takes a long time, as React is updating the entire state again. Here I render the content: const areEqual = (nextProps,...
Read more >
Fix the slow render before you fix the re-render - Kent C. Dodds
How to start optimizing your React app renders. ... Performance is a serious issue and we should make our apps as fast as...
Read more >
How to useMemo and useCallback: you can ... - Developer way
The answer is simple - memoization between re-renders. If a value or a function is wrapped in one of those hooks, react will...
Read more >
How to useMemo and useCallback: you can ... - DevPress
Without it, non-primitive values like arrays, objects, or functions, will be re-created from scratch on every re-render. memoization is ...
Read more >
How to Detect Slow Renders in React? - Alex Sidorenko
Improving React app performance often comes down to finding bottlenecks and fixing them. One well-placed memoization can make a slow app ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found