Good performance is not just big O - Julio Merino (jmmv.dev)
jmmv.dev
external-link
Having a fast and responsive app is orthogonal to “knowing your big Os”. Unfortunately, most tech companies over-emphasize algorithms in interviews and downplay systems knowledge, and I believe that’s one reason behind sluggish apps and bloated systems. I’ve seen this play out repeatedly. Interviewers ask a LeetCode-style coding question, which is then followed by the ritual of discussing time and memory complexity. Candidates ace the answers. But then… their “real” code suffers from subtle yet impactful performance problems. Focusing on big O complexity rarely matters in most apps. Sure, it’s important to think about your algorithmic choices, but there are so many more details to worry about that have a direct impact on app performance and responsiveness. Let’s look at a bunch of them!

Having a fast and responsive app is orthogonal to “knowing your big Os”. Unfortunately, most tech companies over-emphasize algorithms in interviews and downplay systems knowledge, and I believe that’s one reason behind sluggish apps and bloated systems.

I’ve seen this play out repeatedly. Interviewers ask a LeetCode-style coding question, which is then followed by the ritual of discussing time and memory complexity. Candidates ace the answers. But then… their “real” code suffers from subtle yet impactful performance problems.

blazera
link
fedilink
-21Y

Besides an amazing anime, the heck is a big O?

sj_zero
link
fedilink
21Y

Its when you find the clitoris for the first time.

Joking aside, it’s a description of the runtime of a thing for a size of a data set. Its expressed as a function. So for example an exponential function would get longer and longer as your data set size grows, linear time has a basically proportional operating time compared to the size of the data set, and log(n) would see runtime increase very little as data set size increases.

@wizardbeard@lemmy.dbzer0.com
link
fedilink
English
12
edit-2
1Y

Itcs a generalized method/notation of measuring how long a piece of code takes to run for a given input.

O(n2) means that as the input n grows, it takes exponential time to process. Like if you were trying to find items that matched in an array by looping over every item in the array and then using a nested loop in the first one to compare against every other item in the array. You’d be doing (# of items) * (# of items) comparisons, or (# of items)2 comparisons. n2 comparisons.

There’s some rules about simplifying the result down to the most significant portion, so On+n would be simplified as On, but that’s the basics.

It’s a pretty important concept as you get into making larger projects.

O(n2) means that as the input n grows, it takes exponential time to process.

this is really pedantic, but O(n2) is quadratic, not exponential. the exponential runtimes are things like O(2n). when n gets even modestly big (say n=100), youre looking at a difference of 2100 ≈ 1.26×1030 vs 1002 = 10,000. this is just to say that exponential runtime is really in a class of its own.

but otherwise i think this was a pretty good explanation of the concept

Create a post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



  • 1 user online
  • 1 user / day
  • 1 user / week
  • 1 user / month
  • 1 user / 6 months
  • 1 subscriber
  • 1.21K Posts
  • 17.8K Comments
  • Modlog