ResourceScheduler Optimization: Enhancing Critical Image Loading in T7 Browser Kernel
The T7 browser kernel’s ResourceScheduler lets developers assign importance=high to IMG tags and CSS background images (as well as JS and link resources), adjusting sub‑resource loading priority so critical images load faster on the first screen, especially when many concurrent requests compete for the same domain.
This article introduces the ResourceScheduler optimization mechanism in Baidu's T7 browser kernel, which provides frontend developers with the ability to adjust sub-resource loading priority to improve first-screen critical image loading performance.
Background: When loading a web page, multiple types of sub-resources (JS, CSS, IMG) are loaded simultaneously. The kernel schedules these resources based on their priority. However, there was no way for frontend developers to control or adjust the loading priority of critical images. The T7 browser kernel addresses this gap by introducing the ResourceScheduler optimization mechanism.
Usage: For IMG tag images, add the importance=high attribute:
<img importance=high src="xxx.jpg">
For CSS background images, configure background-image-importance:high in either style tags or inline style attributes:
<style> .bk-img { background-image:url("xxx.jpg"); background-image-importance:high; }</style>
<div style="background-image:url(xxx.jpg);background-image-importance:high">
Supported Resources: The mechanism supports IMG tags, CSS background images, JS, and link tags. Configurable values include importance=high, low, or auto. When not configured, the kernel's default resource loading priority is maintained.
Implementation Principle: The kernel initializes default loading priorities for different resource types, then adjusts priorities based on specific scenarios. During resource loading, the ResourceScheduler controls which resources can initiate requests first based on their priority. Low-priority resources are throttled when: 1) more than 6 concurrent requests exist for the same domain, or 2) more than 10 concurrent low-priority requests exist under the same Document.
Effect: The optimization is most effective when a page has many resources from the same domain, as network request competition is higher. Critical resources configured with high priority can stand out and load faster.
Baidu Geek Talk
Follow us to discover more Baidu tech insights.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.