TLDR Web Dev · ARTICLES & TUTORIALS

HOW FAST IS JAVASCRIPT AT SIMULATING 20,000,000 PARTICLES?

dgerrells.com35 min read

Summary from the TLDR Web Dev newsletter

This article explores how to simulate millions of particles in JavaScript, achieving a smooth 60 frames per second using only the CPU, particularly focusing on optimization for mobile devices. The author details their process, which involved several iterations, starting with a basic multi-threaded approach using web workers and SharedArrayBuffers. They faced challenges like flickering and performance bottlenecks in rendering and data transfer. To improve performance, they implemented strategies like double buffering and a particle grid count.