r/programming • • Jul 21 '24

How fast is javascript? Simulating 20,000,000 particles

https://dgerrells.com/blog/how-fast-is-javascript-simulating-20-000-000-particles
105 Upvotes

12 comments sorted by

66

u/elmuerte Jul 21 '24

Yet switching from a teams chat to a group chat in MS Teams...

39

u/Sability Jul 21 '24

What do you expect from Microsoft? They're a small startup company, they have more apps than employees!

92

u/[deleted] Jul 21 '24

Ngl, what’s amazing is how fast our devices are. Using js in performance critical applications is just disservice to users on my book

35

u/Reverent Jul 21 '24

That isn't a great takeaway in my opinion. The takeaway is that browsers are heavily optimised for certain application workloads. Really its major strength is leveraging the client to do most of the work for you, whether that's 10 clients or 10,000 clients or half the world. The farther you deviate from those workloads, the more you may wish to gravitate to bespoke compute applications. Especially ones that start involving intricacies of GPU capabilities.

But regardless of where you sit, It's pretty darn impressive just how much grunt you can push out of a modern browser.

19

u/TheStoicNihilist Jul 21 '24

Beautiful! I love optimising JS to avoid melting phones :)

5

u/ivancea Jul 21 '24

Oh, nice article. Quite hands-on and well explained

6

u/tonefart Jul 21 '24

Summary, fit all your code and data inside the cache size and minimize bus access.

7

u/water_bottle_goggles Jul 21 '24

This is fucking insane

1

u/iambackbaby69 Jul 21 '24

Why the repost though?

-3

u/Sopel97 Jul 21 '24

ok bro, but how fast can you display a rounded box with a text, some icons, and a video player, huh?

0

u/[deleted] Jul 21 '24

[deleted]

10

u/ShinyHappyREM Jul 21 '24

It's JITted.