Open main menu

CDOT Wiki β

Changes

DPS921/Web Worker API

7 bytes removed, 04:25, 4 December 2020
Dedicated Worker
[https://vitokhangnguyen.github.io/WebWorkerDemo/index.html https://vitokhangnguyen.github.io/WebWorkerDemo/index.html]
In the demo, we take a [https://github.com/vitokhangnguyen/WebWorkerDemo/blob/main/wallpaper.jpg 6K image] and apply a Sobel filter. This filter is used to emphasize the edges within an image. It is often used in image processing and computer vision. When we ran the serial code, we noticed the UI lagged (when scrolling) and the cursor remained in the pointer state throughout the entire filtering process, delaying the user from interacting with the user interface. We took an extensive look into this lagging using the performance tool in Firefox. We discovered that the DOM clicking event occurred throughout the entire duration of the function execution (8 seconds for my PC) , and the FPS even almost dropped down to a low of 0.38, as shown in the image below. 
[[File:Firefox Performance.PNG]]
 
To counter this, we used Dedicated Workers to perform the CPU intensive calculations on another thread, enabling the user to interact with the website.
45
edits