Performance and multithreading in browsers + ECMAScript Modules in Web Workers
This repository lets you run a web worker in a browser and use ECMAScript modules in it. In this specific application for example, we can filter around 1 million records in a CSV file, searching for a specific term in around 13 seconds without blocking the main thread of the browser.
We can accomplish that by using Webworkers and WebStreams in the browser. This will run the task on the background thread, and will not block the main thread.
- run the following command to install the dependencies:
$ yarn start
-
Open the browser and go to
http://localhost:3000
-
Select a large csv file. (I used a 1 million records file)
-
Type a term to search for in the input field.
-
Click on the
Search
button. -
Wait for the results to be displayed.