Close Menu
  • Home
  • Life style
    • Beauty tips
    • Exercise & Training
    • Fashion
    • Healthline
  • Exploration
    • Celebrities
    • Business
    • Travel guides
    • Technology
  • Web tutorials
    • Hosting & Servers
    • Blogger guides
    • WordPress guides
  • English
    • Tiếng Việt
    • Hmong
    • English
Facebook YouTube X (Twitter) Instagram
Trending
  • How to Install Windows 8.1, 10, or 11 With a Valid License
  • Search Profile or Preferred Sources: Choose the Right Tool for Your Website
  • Set Up Brevo for WordPress: Verify Senders and Test SMTP Email
  • Samsung Galaxy S27 Ultra: 5,700mAh Battery, 60W Charging and Open Questions
  • How to Create a Better-Looking Blogger Comment Box with CSS
  • Amazfit’s Lactate Threshold Update: Use the Data to Run at the Right Effort
  • How to Check Whether Yandex Has Indexed an Article
  • Set Yandex Site Region and Check How Your Website Appears
Facebook YouTube X (Twitter) Instagram
SaibABCSaibABC
Chú thích cho quảng cáo
  • Home
  • Life style
    1. Beauty tips
    2. Exercise & Training
    3. Fashion
    4. Healthline
    5. View All

    Build a Simple Skincare Routine Without Buying Too Many Products

    30/08/2026

    How to choose mineral sunscreen that does not leave a white cast

    30/08/2026

    What Does PDRN in Cosmetics Do? How to Read Advertising

    30/08/2026

    Skincare While Losing Weight: Keep Skin More Hydrated, Healthy, and Firm

    30/08/2026

    Running in Hot Weather: Read WBGT and Know When to Stop

    19/09/2026

    Exercise With Atrial Fibrillation: How to Start and Progress Safely

    19/09/2026

    Five-Minute Office Exercises: A Snack-Sized Movement Schedule

    30/08/2026

    Strengthen Your Core with 12 Exercises from Beginner to Advanced

    30/08/2026

    Fashion Digital Product Passport: What Can You Read?

    30/08/2026

    Build a Minimalist Wardrobe in 2026: Buy Less, Wear Longer

    30/08/2026

    Winter Travel Fashion: Stylish Outfits for Men and Women

    22/12/2023

    Amazfit’s Lactate Threshold Update: Use the Data to Run at the Right Effort

    28/09/2026

    Running in Hot Weather: Read WBGT and Know When to Stop

    19/09/2026

    Exercise With Atrial Fibrillation: How to Start and Progress Safely

    19/09/2026

    Suunto Run Heart-Rate Tracking After an Update: Check Your Zones Before Running

    19/09/2026

    Amazfit’s Lactate Threshold Update: Use the Data to Run at the Right Effort

    28/09/2026

    Running in Hot Weather: Read WBGT and Know When to Stop

    19/09/2026

    Exercise With Atrial Fibrillation: How to Start and Progress Safely

    19/09/2026

    Suunto Run Heart-Rate Tracking After an Update: Check Your Zones Before Running

    19/09/2026
  • Exploration
    1. Celebrities
    2. Business
    3. Travel guides
    4. Technology
    Featured

    How to Install Windows 8.1, 10, or 11 With a Valid License

    By Nuj Coom14/10/2026
    Recent

    How to Install Windows 8.1, 10, or 11 With a Valid License

    14/10/2026

    Samsung Galaxy S27 Ultra: 5,700mAh Battery, 60W Charging and Open Questions

    29/09/2026

    Samsung Galaxy S26 Ultra Review: What Makes It Worth Buying—and What Doesn’t

    16/09/2026
  • Web tutorials
    1. Hosting & Servers
    2. Blogger guides
    3. WordPress guides
    4. View All

    Let’s Encrypt on Vultr: Enable HTTPS and Automatic Renewal

    09/09/2026

    Install WordPress on Vultr Manually: From Ubuntu to HTTPS

    08/09/2026

    Point Your Domain to a Vultr VPS and Verify the DNS Connection

    08/09/2026

    Set Up an Ubuntu VPS on Vultr: From Account Creation to SSH

    07/09/2026

    How to Create a Better-Looking Blogger Comment Box with CSS

    28/09/2026

    A 90-Day Blog Growth Plan: Write, Measure, and Improve

    26/09/2026

    Blogspot Maintenance: Fix Broken Links, Images, and Slow Pages

    26/09/2026

    How Does Google Find a Blog? The 3 Key Stages Explained

    26/09/2026

    Set Up Brevo for WordPress: Verify Senders and Test SMTP Email

    29/09/2026

    How to Check Whether Yandex Has Indexed an Article

    26/09/2026

    Set Yandex Site Region and Check How Your Website Appears

    26/09/2026

    What to Prepare Before Connecting a Website to Yandex Webmaster

    26/09/2026

    Search Profile or Preferred Sources: Choose the Right Tool for Your Website

    14/10/2026

    Set Up Brevo for WordPress: Verify Senders and Test SMTP Email

    29/09/2026

    How to Create a Better-Looking Blogger Comment Box with CSS

    28/09/2026

    How to Check Whether Yandex Has Indexed an Article

    26/09/2026
  • English
    • Tiếng Việt
    • Hmong
    • English
SaibABCSaibABC
Home»Exploration»Technology»CPU Performance API: Make Web Interfaces Lighter for Low-End Devices
Technology 10 Mins ReadNo Comments

CPU Performance API: Make Web Interfaces Lighter for Low-End Devices

Nuj CoomBy Nuj CoomUpdated:23/09/2026
Facebook Twitter Pinterest LinkedIn Tumblr Email
Chú thích cho quảng cáo

Contents

  1. Distinguish CPU capability from CPU pressure
  2. Prepare profiles before reading the API
  3. Implement the initial profile and fallback
  4. Monitor CPU pressure without making the interface flicker
  5. Disable only non-essential components with CSS and JavaScript
  6. Check HTTPS, browser support, and iframes
  7. Verify the results before release
  8. Common errors and rollback
  9. A Practical Rollout Strategy
  10. Conclusion
  11. Reference source

In brief: use navigator.cpuPerformance to choose the initial profile, then use PressureObserver to monitor the cpuWhen the state is serious or critical, disable non-essential effects and tasks; if the API is unavailable or does not work, use a predefined light or balanced profile.

This approach supports an adaptive web experience: powerful machines can retain the full set of effects, while less capable devices can reduce animations, background video, update frequency, or secondary processing. This is not an accurate benchmark and does not guarantee that every site will be faster. You must still optimize JavaScript, images, and network usage as usual.

Distinguish CPU capability from CPU pressure

SignalWhat question does it answer?What should it be used for?
navigator.cpuPerformanceWhich CPU capability tier does the device belong to?Choose the initial profile when the page initializes.
PressureObserverHow much pressure is the CPU under right now?Reduce or restore non-essential features while the page is running.

The CPU Performance API provides a relatively stable signal about a performance tier, while the Compute Pressure API reflects a dynamic state that may be affected by other tabs or applications. States such as nominal, fair, serious and critical are not specific CPU percentages (according to developer.mozilla.org).

Therefore, do not write a condition such as “enable effects when CPU usage is below 40%.” Use the tier to choose the initial configuration, then use the pressure state to pause secondary features. Chrome 152 introduced the CPU Performance API through navigator.cpuPerformance; the reported tier may be overridden by the user or administrator in some environments, so applications must not treat this value as conclusive evidence about the hardware (according to developer.chrome.com).

Prepare profiles before reading the API

The API is useful only when the website already has features that can be scaled back. Start with three clearly defined profiles:

Chú thích cho quảng cáo
ProfileBehaviorWhen to use it
lightDisable decorative animations and background video, stop unnecessary background tasks, and refresh less frequently.Low or unknown tier, or CPU in a serious state.
balancedKeep effects brief, load data only when needed, and limit secondary updates.A safe fallback for most cases where there is not enough signal.
fullKeep effects and secondary tasks when they do not reduce interaction responsiveness.High tier and CPU pressure at an acceptable level.

Keep content reading, text entry, navigation, form submission, and post-action feedback intact. In a dashboard, you can disable chart animations and reduce the refresh frequency, but you should not hide filters or delay button responses.

If the page is loading many animated images, converting GIFs to video to reduce file size is a separate optimization approach. The CPU Performance API does not replace reducing resource sizes or fixing JavaScript that is already too heavy.

Implement the initial profile and fallback

Run the following JavaScript in the page’s browser-side code after the DOM is ready or at the end of the HTML document. Replace the body of updateNonCriticalData() with the application’s actual task. The tier thresholds in this example are only starting points; adjust them based on the actual cost of each feature.

const profiles = {
  light: {
    effects: false,
    backgroundWork: false,
    refreshInterval: 15000,
  },
  balanced: {
    effects: true,
    backgroundWork: false,
    refreshInterval: 10000,
  },
  full: {
    effects: true,
    backgroundWork: true,
    refreshInterval: 5000,
  },
};

let activeProfileName = 'balanced';
let backgroundTimer = null;

async function updateNonCriticalData() {
  // Thay bằng việc tải hoặc tính toán không thiết yếu của ứng dụng.
}

function setBackgroundWorkEnabled(enabled, interval) {
  if (backgroundTimer !== null) {
    clearInterval(backgroundTimer);
    backgroundTimer = null;
  }

  if (enabled) {
    backgroundTimer = window.setInterval(
      updateNonCriticalData,
      interval
    );
  }
}

function applyProfile(profileName) {
  const profile = profiles[profileName];
  if (!profile) return;

  activeProfileName = profileName;
  document.documentElement.classList.toggle(
    'low-power-mode',
    !profile.effects
  );
  setBackgroundWorkEnabled(
    profile.backgroundWork,
    profile.refreshInterval
  );
}

function getInitialProfile() {
  if (!('cpuPerformance' in navigator)) {
    return 'balanced';
  }

  const tier = navigator.cpuPerformance;
  if (!Number.isInteger(tier) || tier === 0) {
    return 'balanced';
  }

  // Đây là ngưỡng minh họa; kiểm tra lại bằng chi phí thật của ứng dụng.
  return tier <= 2 ? 'light' : 'full';
}

applyProfile(getInitialProfile());

Profile balanced is the safe fallback in this example, while profile light is used when the tier is identified as low. If your product prioritizes reducing load over the default visual presentation, you can change the fallback to light; check support again before deployment.

Monitor CPU pressure without making the interface flicker

Place the following code immediately after the profile code. This pattern requires a high state to occur consecutively before switching to light, and requires several normal readings before restoring the initial profile. This mechanism is called delay or hysteresis; it prevents state changes in response to a brief signal.

function watchCpuPressure() {
  if (!('PressureObserver' in window)) {
    return;
  }

  const initialProfile = getInitialProfile();
  let seriousSamples = 0;
  let normalSamples = 0;

  const observer = new PressureObserver((records) => {
    const latest = records[records.length - 1];
    if (!latest) return;

    const pressureIsHigh =
      latest.state === 'serious' || latest.state === 'critical';

    if (pressureIsHigh) {
      seriousSamples += 1;
      normalSamples = 0;

      if (seriousSamples >= 3) {
        applyProfile('light');
      }
      return;
    }

    seriousSamples = 0;
    normalSamples += 1;

    if (normalSamples >= 5) {
      applyProfile(initialProfile);
    }
  });

  observer.observe('cpu', { sampleInterval: 1000 }).catch((error) => {
    console.warn('Không thể theo dõi áp lực CPU:', error);
  });
}

watchCpuPressure();

sampleInterval: 1000 is only an illustrative value. If the browser does not accept the cpu source or observation options, the call to observe() may be rejected; in that case, continue using the profile applied in the previous step. This error does not need to be treated as one that blocks the entire page.

Disable only non-essential components with CSS and JavaScript

CSS is suitable for decorative elements, but hiding an element does not mean that JavaScript has stopped processing. Add the following rules to the page’s CSS file:

.low-power-mode .decorative-animation,
.low-power-mode .background-video {
  display: none;
}

.low-power-mode .chart {
  transition: none;
}

For background tasks, stop the timers or skip unnecessary computation. The setBackgroundWorkEnabled() function above clears the timer before creating it again. If the actual task uses requestAnimationFrame, Web Worker or a charting library, add the corresponding stop operation instead of merely adding a CSS class.

If the user has enabled reduced motion or manually selected a power-saving mode, that choice should take precedence. Do not allow the automatic restoration of the full profile to override an accessibility preference or an explicit user setting.

Check HTTPS, browser support, and iframes

Check HTTPS, browser support, and iframes
  • Run in a secure context: a production website should use HTTPS with a valid certificate. During local development, localhost is generally more suitable than opening the HTML file directly.
  • Check feature support: use 'cpuPerformance' in navigator and 'PressureObserver' in window, rather than inferring support from the browser’s name or version alone.
  • Keep the fallback: unsupported browsers must still be able to read the content, navigate the site, and complete the primary task.
  • Check iframes: if the code runs in an iframe, check the origin and Permissions Policy before concluding that the API is failing.
  • Minimize data collection: use the tier only to adjust the on-site experience; do not turn this signal into a device-identification profile.

The Compute Pressure API currently has uneven coverage across major browsers, and MDN records it as having limited availability. Therefore, it should be treated as progressive enhancement rather than a prerequisite for loading the page (according to developer.mozilla.org).

Verify the results before release

  1. Check the initial state: open the page in environments with and without the APIs; confirm the selected profile, the low-power-mode class, and the corresponding timers.
  2. Test the low profile: use the CPU-tier override mechanism in Chrome 152 if your test environment provides that option. Do not use this option as evidence about every real-world device.
  3. Test dynamic pressure: in a safe test environment, confirm that sufficiently high pressure disables effects and actually stops background tasks.
  4. Measure the workload: use Chrome DevTools Performance to inspect long tasks, JavaScript activity, the number of repaints, and the update frequency before and after applying the profile.
  5. Test restoration: confirm that restoring the profile does not lose form state, create duplicate network requests, or make the interface flicker.
  6. Test the primary task: reading, data entry, navigation, and form submission must work in the low profile.

The success criterion is not “the tier was read,” but that the low profile actually removes some non-essential work while users can still complete their tasks. If an icon is merely hidden with CSS while the code continues computing at the same frequency, the implementation has not met its objective.

Common errors and rollback

  • Treating the tier as a benchmark: the tier is only a classification group; do not use it to promise a specific execution time.
  • Reading it only once: the initial capability does not reflect pressure caused by other applications, other tabs, or thermal throttling.
  • Disabling primary functionality: reduce decorative elements and secondary tasks first; the low profile must remain usable.
  • Switching profiles too quickly: use consecutive readings or a minimum duration as shown in the example to prevent state flicker.
  • Failing to handle errors observe(): keep a fallback profile when the source cpu is not supported.
  • Override user choices: accessibility settings and manual choices must take precedence over automated decisions.

If the automated logic causes problems, the safe rollback is to stop calling watchCpuPressure() but retain the initial profile and feature checks. If that profile still causes problems, set activeProfileName it to balanced, disable non-essential background tasks individually, and check the main flow again. Restore the profile full only after confirming that the effects do not reduce responsiveness.

A Practical Rollout Strategy

Start with an easily observable feature, such as a background video, chart animation, or update timer. Record the state before integration, deploy the light profile, measure the task again, and test the primary task. Once the fallback path is stable, expand to image processing, data preloading, or more CPU-intensive JavaScript tasks.

Do not create too many quality levels at the outset. Three profiles light, balanced and full are generally easier to test, but the thresholds and contents of each profile must be based on the application's actual costs. The API provides signals only; the development team remains responsible for deciding which features to disable.

Conclusion

The CPU Performance API is suited to selecting the initial experience level, while the Compute Pressure API is suited to responding to changes while the page is running. A safe implementation requires feature detection, HTTPS, a fallback profile, protection against constant state switching, respect for user choices, and verification that non-essential tasks are actually reduced.

Treat this as a progressive enhancement layer, not as an accurate method for measuring device speed. If the browser does not provide the signal, the website must still function normally with a balanced or light profile.

Related reading: Move XSLT out of the browser before Chrome 158 ends support.

Reference source

  • New in Chrome 152— Chrome for Developers.
  • Chrome 152 | Release notes— Chrome for Developers.
  • Compute Pressure API – Web APIs— MDN Web Docs.
  • WICG/cpu-performance— Web Incubator Community Group.
  • Compute Pressure API— Chrome for Developers.

Chú thích cho quảng cáo
Chrome Compute Pressure API CPU Performance API JavaScript Web Performance Web platform
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Previous ArticleMove XSLT out of the browser before Chrome 158 ends support
Next Article Connection-Allowlist in Chrome 152: Limit Endpoints Without Breaking Your App
Nuj Coom
  • Website
  • Facebook
  • X (Twitter)
  • Instagram

I'm a doctor, for sure. But I also love writing and sharing knowledge, life experiences, web tricks, and useful lectures. Let's cheer for your passion.

Related Posts

How to Install Windows 8.1, 10, or 11 With a Valid License

14/10/2026

Search Profile or Preferred Sources: Choose the Right Tool for Your Website

14/10/2026

Set Up Brevo for WordPress: Verify Senders and Test SMTP Email

29/09/2026
Add A Comment
Leave A Reply Cancel Reply

Latest posts

After Applying for AdSense: Read Feedback, Show Ads, Track Payments

Blogger Settings to Check Before You Publish More Posts

Designing a Malware Package Advisory Pipeline You Can Roll Back

Build a Simple Skincare Routine Without Buying Too Many Products

How to Create a Blogger Blog with a Google Account and Publish Its Public Address

Advertisement
Chú thích cho quảng cáo

SUBSCRIBE TO UPDATES

Get the latest creative news from SaibABC.Com on web tips, design, and business.

Copyright © 2024. Designed by NujCoom.
  • Home
  • Contact
  • Privacy
  • Tiếng Việt
  • Hmong

Type above and press Enter to search. Press Esc to cancel.