web worker loop optimized