Metrics
threadPerf

threadPerf

threadPerf is a normalized score from 1 to 4 (higher is better) that measures the real-time single-thread execution performance of the browser's Main Thread.

What It Measures

JavaScript execution, DOM updates, event handling, and layout rendering all compete for time on a single Main Thread (V8, JavaScriptCore, or SpiderMonkey). When single-thread capacity is saturated, user interactions stall and frame rates drop.

Unlike static device databases, threadPerf evaluates live single-core throughput in the active browser tab—accounting for CPU architecture, browser engine overhead, and active thermal throttling.

Score Breakdown

ScoreTierExecution ProfileRecommended Adaptation
4FlagshipMaximum single-core speed and Main Thread headroom.Full experience: 3D/WebGL scenes, complex animations, rich media.
3StandardSolid responsiveness for modern web applications.Standard interactive UI, asynchronous third-party widgets.
2ConstrainedLimited single-thread headroom; sensitive to heavy scripts.Disable non-essential animations; defer heavy third-party tags.
1Entry-LevelSevere single-thread bottleneck; high risk of UI freezes.Strict lightweight mode; strip heavy DOM elements and video embeds.

Primary Use Case: Google INP & UX Shield

Interaction to Next Paint (INP) is a Core Web Vital that measures how quickly a page responds to user clicks, taps, and keyboard inputs. A score above 200ms penalizes SEO rankings and conversion rates.

By checking threadPerf before mounting heavy components, you can prevent Main Thread congestion on tiers 1 and 2 while preserving rich visuals for tiers 3 and 4.

Code Example

async function configureUIExperience() {
  try {
    const threadPerf = await window.sd.threadPerf.get();
 
    if (threadPerf === 4) {
      // Flagship single-thread speed: load full interactive 3D hero
      await UI.mountInteractive3DScene();
    } else if (threadPerf === 3) {
      // Standard speed: load high-res static assets with subtle transitions
      await UI.mountStandardHero();
    } else {
      // Score 1 or 2: protect Google INP (< 200ms) on constrained devices
      UI.disableHeavyAnimations();
      AdServer.requestLightweightFormats();
    }
  } catch (err) {
    // Safe fallback if profiling is interrupted
    await UI.mountStandardHero();
  }
}

Dynamic Updates: Current Capacity

Because Impulse continuously profiles the device in the background, calling .get() always reflects current execution conditions rather than a stale page-load snapshot.

Note that using .on(handler), handler is called each time the metric changes.