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

Improve cells performance #584

Merged
merged 2 commits into from
Aug 23, 2018
Merged

Improve cells performance #584

merged 2 commits into from
Aug 23, 2018

Conversation

mostafa-sakhiri
Copy link
Contributor

This is related to #12 .
The utils method cssStyleify is not scalable when displaying many cells.
Indeed, the method do the following on every cell

  • Introspect each object to get the keys
  • Instantiate a new array
  • Iterate over the hash object
  • Try to dasherize the key
  • HtmlSafe the returned string

This leads to a lot of memory management operations (including garbage collection phases) for the JS VM and it's very slow.
We can get a significant performance gain by bypassing cssSyleify in this case.


if (this.get('enableScaffolding') || !column) {
return '';
}

return cssStyleify(column.getProperties(['width']));
// For performance reasons, it's more interesting to bypass cssStyleify
// which can leads to a lot of garbage collections
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*since it leads to

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. You are welcome.

@alexander-alvarez
Copy link
Collaborator

Thanks for this 👍

@mostafa-sakhiri
Copy link
Contributor Author

mostafa-sakhiri commented Aug 23, 2018

To be more clear about the performance gain that we got :
In our context, we have an ember-light-table@1.12.2 on ember@2.4.6 with 300 cells (50 rows / 6 columns), and it's too slow (~9600 ms).
When implementing the solution above we gained a 33% of performance.

@alexander-alvarez alexander-alvarez merged commit 3350fe8 into adopted-ember-addons:master Aug 23, 2018
@alexander-alvarez
Copy link
Collaborator

Yeah, performance has been a problem area that we're always looking to improve on.

This addon has slowly been integrating vertical-collection that also helps with the problem (you can see the example code here http://offirgolan.github.io/ember-light-table/#/cookbook/occlusion-rendering). Basically with it we only render the rows that a user could see, instead of the whole table, and dynamically updates what's rendered as you scroll

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.

3 participants