paint-brush
Leveraging Multithreading To Read Large Files Faster In Goby@mohammed-gadiwala
7,922 reads
7,922 reads

Leveraging Multithreading To Read Large Files Faster In Go

by Mohammed Gadiwala4mNovember 21st, 2019
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The trick is to not load the whole file into memory and keep processing each word as we keep on moving the pointer of the file. With this, we can easily process the whole. file with a minimal amount of memory resources. The solution is we keep multiple pointers at different parts of the. file and each thread. reads chunks of. the file concurrently. We are using channels to unify all the words read by various threads into a single dictionary. The time required to process the 1GB file was halved by doing it in a serial manner.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Leveraging Multithreading To Read Large Files Faster In Go
Mohammed Gadiwala HackerNoon profile picture
Mohammed Gadiwala

Mohammed Gadiwala

@mohammed-gadiwala

Backend engineer | Golang

Learn More
LEARN MORE ABOUT @MOHAMMED-GADIWALA'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Mohammed Gadiwala HackerNoon profile picture
Mohammed Gadiwala@mohammed-gadiwala
Backend engineer | Golang

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite