Classic UI responsiveness problem

Just a guy who loves to write code and watch anime.
Search for a command to run...

Just a guy who loves to write code and watch anime.
No comments yet. Be the first to comment.
Qualities that make outstanding builders.

Bipedal vs quadrupedal: how many legs This is about the number of legs the creature walks on. Bipedal. Two legs. Humans, ostriches, T-rex, kangaroos, most fantasy humanoids. Quadrupedal. Four legs. Do

Intro You hear "lerp" and "smoothstep" everywhere in game dev. They sound like math jargon. They're not. Both are small tools that do the same job: smoothly move from one value to another. The problem

What is Kinematics Kinematics is the math field. It's the study of how things move without worrying about forces (which would be dynamics). FK and IK are the two branches: forward kinematics and inver

Intro Textures are usually the biggest cost in a 3D scene. Memory, bandwidth, and load time all get eaten by them. Resizing them is the obvious lever. There's more. This post is about the less obvious

We'll dive into a classic UI responsiveness problem. One where you interact with the UI and suddenly things freeze.
Heavy computations in the main thread can block the UI.
Move heavy computations to a different thread.
In the world of web development, we have the option of using web workers.
The fundamental problem is keeping the UI responsive while you do heavy computations.
One example is an image editing tool where you apply a bunch of edits to an image. The image needs to process each edit and apply it to the image. If processing each edit blocks the main thread, the UI will freeze. Meaning, while the processing happens, you can't do anything else.
This isn't just tied to the web. It's a general UI responsiveness problem.
The solution is to move the heavy computations to a different thread. This way, the main thread isn't blocked and can continue to process other functions.
On the web, we can use web workers to move the heavy computations to a different thread.
It's worth noting that web workers can't directly access the DOM. However, you can receive data from the web worker and update the DOM from the main thread after receiving the data.