Navigate Select ESC Close

Benchmarking JavaScript Is A Mess

2024-12-31 Science & Technology
55.8k
1.3k
133
ThePrimeTime
ThePrimeTime
1.1m subscribers

Unlock all features

FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.

Description

Twitch https://twitch.tv/ThePrimeagen Discord https://discord.gg/ThePrimeagen Become Backend Dev: https://boot.dev/prime (plus i make courses for them) This is also the best way to support me is to support yourself becoming a better backend engineer. ### LINKS https://byteofdev.com/posts/javascript-benchmarking-mess/ By: Jacob Jackson | https://asyncbanana.dev/ Great News? Want me to research and create video????: https://www.reddit.com/r/ThePrimeagen Kinesis Advantage 360: https://bit.ly/Prime-Kinesis Get production ready SQLite with Turso: https://turso.tech/deeznuts

Top Comments (10)

@theftking 2024-12-31

Bro never benchmark JS. I know a guy who benchmarked JS. He died. Was it because he benchmarked JS? Who knows, but to be safe, I wouldn't.

299 15 replies
@matelocopoco 2024-12-31

remove benchmarking from the title

250 7 replies
@lcarsos 2024-12-31

I miss these reading an article videos. Helps me keep up with where programming is at when I can't catch live.

68
@flygonfiasco9751 2024-12-31

Knuth was NOT talking about optimizing to assembly when writing in C. He was saying programmers should not waste time in optimizing the 97% of their application that doesn’t matter but should also feel enabled to optimize “that critical 3%” that does matter

50 5 replies
@jeanlasalle2351 2025-01-01

9:40 Premature optimization is bad in the sense that you shouldn't write bit hacks or SIMD when it may not matter or worse may cause optimization not to happen (sometimes a bit shift may prevent the compiler to do a better job). Of course, that doesn't mean you should write bad code with awful performance. There is something in between: Working, decent but you didn't try to optimize further.

19 1 replies
@josephguenther 2024-12-31

Most of my performance issues are me being an asshole and creating a million objects or running some absolute dogshit query.

19 1 replies
@almicc 2024-12-31

There's only a few things I consider when thinking about performance: how many times am I iterating over this list, can I organize this data in one step and then process it easier in another, how many network requests am I making, how many promises can I remove/ combine. My company's code base has several places with O(n^3) loops with awaited network requests, repeated twice for no reason, and mongo cursors with batch sizes of 1 that expect to pull thousands of results. I've turned 10 minute functions into 5 second functions by breaking the nested loops, increasing batch sizes, and not waiting for network requests it doesn't care about. There was even a place that made a network request, and then checked a local cache to determine if the network request was needed. Do less, and be most averse to sequential network requests.

13 2 replies
@adambickford8720 2025-01-01

Premature abstraction is roughly 3,432,872 times worse than premature optimizations.

7
@nerdycatgamer 2025-01-03

solution: stop running JS on the server when it was never meant to run anywhere other than in the browser

5
@shining_cross 2025-01-01

benchmarking is good, you just need to do it in right way, like using real world load based on what you will do in production, like testing it with your production data, not hello world or for loop. so you know if this one really fits for my spesific use case

3

Unlock the Data Inside
Turn Videos into Knowledge

  • Get FREE 10/day: transcripts, summaries, chats
  • Chat with videos, export text & PDF
  • $1 free API credit for RAG, chatbots & research

Free forever plan • All features unlocked

App screenshot