MCPcopy Create free account
hub / github.com/CNCKitchen/stlTexturizer / _yieldFrame

Function _yieldFrame

js/decimation.js:100–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98
99// Time-based yield: only yield every ~100ms of wall time instead of every N iterations.
100// In foreground tabs setTimeout(0) costs ~4ms; in background tabs it's throttled to ~1s.
101// By yielding based on elapsed time we get ~10 yields per second in foreground (smooth progress)
102// and minimal extra delay in background (~10 yields × 1s = ~10s overhead instead of ~200s).
103let _lastYieldTime = 0;
104function _shouldYield() {
105 const now = performance.now();

Callers 1

decimateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected