devicePerf
devicePerf is a normalized score from 1 to 4 (higher is better) that measures the overall multi-thread compute capacity of the client device.
What It Measures
While threadPerf measures responsiveness on the UI thread, devicePerf evaluates total parallel compute throughput across available CPU cores and memory bandwidth. It determines whether a device can sustain heavy background computation without freezing the OS, draining battery rapidly, or triggering browser Out-of-Memory (OOM) tab crashes.
Score Breakdown
| Score | Tier | Multi-Thread Capacity | Recommended Workload Routing |
|---|---|---|---|
4 | High-Compute | Workstation-class desktop or flagship mobile silicon. | Execute heavy Wasm, client-side data processing, and media encoding locally. |
3 | Capable | Reliable multi-core performance for background tasks. | Safe for moderate client-side computation using Web Workers. |
2 | Limited | Low parallel throughput or tight memory constraints. | Offload heavy computation to server-side Cloud APIs. |
1 | Minimal | Entry-level hardware or virtualized/headless environments. | Strictly cloud-side execution; avoid background worker pools. |
Primary Use Case: FinOps Edge-vs-Cloud Router
Executing compute-intensive tasks (such as client-side database filtering, image/video transcoding, encryption, or complex simulations) directly in the user's browser reduces backend cloud infrastructure costs (AWS/GCP) to $0. However, pushing those workloads blindly to low-end devices causes tab crashes.
devicePerf acts as a deterministic FinOps router: high-scoring devices (3 and 4) execute workloads locally at the edge, while low-scoring devices (1 and 2) seamlessly fall back to your cloud backend.
Code Example
async function processDataset(payload) {
let devicePerf = 1;
try {
devicePerf = await window.sd.devicePerf.get();
} catch (err) {
console.warn('Impulse profiling unavailable, defaulting to cloud execution.');
}
// Route to local browser compute on capable devices (Scores 3 & 4)
if (devicePerf >= 3) {
const numThreads = await window.sd.numThreads.get();
return await executeLocalWasmPipeline(payload, { workers: numThreads });
}
// Fallback to Cloud API on constrained devices (Scores 1 & 2) to prevent OOM crashes
const response = await fetch('[https://api.yourdomain.com/v1/process](https://api.yourdomain.com/v1/process)', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
});
return await response.json();
}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.