• 1 Post
  • 19 Comments
Joined 1 year ago
cake
Cake day: June 19th, 2023

help-circle















  • stop dismissing performance questions

    I did not dismiss it, I said measure the performance yourself.

    Performance matters, learning about performance matters

    Which is why I said you should measure performance. It’s no use waffling about unmeasurable performance gains.

    Did they ask if they should optimize, or did they ask which one generates more performant assembly?

    To be pedantic, GDScript is an interpreted language, and does not generate bytecode or assembly. This means that the code performance is highly dependent on runtime conditions, and needs to be measured in the place where it’s used.

    Maybe they already measured and already knows this is a bottleneck.

    If they already measured, then they would know which one is faster, because they measured it.

    I swear half the reason every piece of modern software runs like shit is because nobody bothered to learn how to optimize

    This is unrelated to what I said, which is “you should measure your performance to see what you need to optimize”.

    There’s tons of little “premature” optimizations that you can do that aren’t evil.

    And all of these optimizations are just as effective after you measure them to see if they’re needed, and they’re no longer premature.

    Estimating time complexity and load size

    Accurately estimating the performance impact of a design choice means the optimization is no longer premature. The rule-of-thumb is about using optimizations without taking appropriate time to their overall performance benefit. The particular question asked by the OP is very very unlikely to have any significant performance impact at all, unless it’s in an extremely hot loop running millions of times per frame, at which point you should measure it to see which one is faster in your use case.