简体   繁体   中英

Do long-running main-thread scripts block scroll painting?

For example in the below timeline, I'm scrolling up and down between 3s mark and 7s mark. The scrolling does not appear to be smooth. The closeup is the first and largest block of scripting (200ms). My understanding is that the browser cannot both do main-thread JS and paint at the same time. Is that correct? If yes, then if that block of script is removed, then the green painting section that follows can be performed sooner, thereby resulting in smoother scrolling?

在此处输入图片说明

Closeup:

在此处输入图片说明

Yes and yes. Move long-running JS to a worker.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM