• 0 Posts
  • 21 Comments
Joined 3 years ago
cake
Cake day: June 13th, 2023

help-circle










  • These are fun rabbit holes to go down. Everything here is true, of course: Big-O complexity isn’t everything, context always matters, and measurements trump guesses.

    But also, how many times have you encountered a performance problem with a slow O(n) solution that you solved by turning it into a fast O(n²) solution, compared to the other way around? The difference between 721ns and 72.1ns is almost always irrelevant (and is irrelevant if it’s not on a hot path), and in all likelihood, the same can be said at n=500 (even 500x these numbers still doesn’t even reach 0.5ms).

    So unless context tells me that I have a good reason to think otherwise, I’m writing the one that uses a hash-based collection. As the codebase evolves in the future and the same bits of code are used in novel situations, I am much less likely to regret leaving microseconds on the table at small input sizes than to regret leaving milliseconds or seconds on the table at large input sizes.

    As a trained practicioner of “the deeper magics” myself, I feel the need to point out that there’s a reason why we call these types of things “the deeper magics”, and that’s because heuristics like “better Big-O means better performance” generally point you in the right direction when it matters, and the wrong direction when it doesn’t matter.







  • I can’t even imagine how my friend would take it.

    OK, OK, time out. You haven’t tried talking with them about it? If you have as strong a mutual (platonic(ish?)) relationship with them as you say you do, then it should be able to survive a serious conversation about your shared future, especially if you emphasize that you want to try to keep them in your life in a major way like this.

    That conversation will probably be hard, and I really can’t think of a solution that would feel perfect if I were in your shoes, but I would sure as hell rather have that conversation than the “I made a decision, and here is how you will be impacted” one, or the “I kept my life on hold because I was worried how you might react to talking about it” one.

    I don’t know your personality or your friend’s personality, so I can’t promise that you will sort it all out without emotions running high, or what the ultimate outcome of such a conversation will be.

    But jeez, bud, you’ve GOT to be able to have serious talks with people whom you trust and care about.