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

Batching read / writes to improve performance #1865

Conversation

Mattchewone
Copy link
Contributor

This PR improves performance by batching the read / writes.

Related to - #1860 (comment)

@RunDevelopment
Copy link
Member

First of all, thank you for committing this fix!

Now, please run gulp to update the minified files (that's why the build failed).

@Mattchewone Mattchewone force-pushed the #1860-prism-line-highlight-is-slow-on-resize-because-it-forces-a-reflow-for-every branch from 29c5f01 to af25528 Compare April 23, 2019 21:20
@Mattchewone Mattchewone force-pushed the #1860-prism-line-highlight-is-slow-on-resize-because-it-forces-a-reflow-for-every branch from af25528 to 18b56fb Compare April 23, 2019 21:30
@Mattchewone
Copy link
Contributor Author

@RunDevelopment Hopefully this resolves the issues, should now include the changes to the file and the updated min file.

@RunDevelopment
Copy link
Member

Yup, that works! Thank you!

@Mattchewone
Copy link
Contributor Author

That's ok, sorry for making a bit of a mess of this PR. But we got there in the end.

@RunDevelopment
Copy link
Member

I will fully review your PR soon.

@RunDevelopment
Copy link
Member

I made you a PR with a few improvements.

Also, could you please provide an example which shows the reflow problem?
I can see the code that causes reflow but I cannot reproduce that this reflow significantly influences the overall performance. And certainly not as much as in your original issue.

@justinbmeyer
Copy link

@RunDevelopment , depending on your hardware, you should be able to see the problem on this page: https://www.bitovi.com/academy/learn-angular/creating-components.html. This was the page the original issue's performance graph was made from. Since that time, I've split that page into another page to improve the performance.

Despite this I can still visually see a delay when I resize the window. You can see this in the following GIF. Notice that as I resize to see more of the screen, the "new" parts are white for a few ms.

Recording-9

With this fix, resizing feels instantaneous.

@RunDevelopment
Copy link
Member

@justinbmeyer Thanks for sharing this!
I can definitely see the issue. Resizing takes more than a second on my laptop.

Hopefully, the page-splitting won't be necessary anymore after this fix.

@Mattchewone
Copy link
Contributor Author

I have merged the changes made to this branch, so we should be good to go now.

Thanks all

@justinbmeyer
Copy link

When do you think this might be part of a release? Thanks!

@RunDevelopment
Copy link
Member

We don't have a fixed release schedule, so I can't say with certainty when a new version gets released.
But maybe a month or so.

In the meantime, you can always get the latest version of Prism at our download page. This version includes this PR.

@justinbmeyer
Copy link

justinbmeyer commented Jul 17, 2019

Sorry to bother again, but any chance you'll be releasing soon? I'd like to avoid changing our packages from using npm to a download (especially as we have multiple projects using prism and our build makes sure only one prism gets included). Thanks!

@RunDevelopment
Copy link
Member

Very soon!

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