Live data from Hacker News

Look Out for Bugs

matklad.github.io

41–42 of 42 posts

Re: Look Out for Bugs

#41
post #36
post #8

Earlier quoted context omitted.

You totally can identify performance issues by reading code. E.g. spotting accidentally-quadratic, or failing to reserve vectors, or accidental copies in C++. Or in more amateur code (not mine!) using strings to do things that can be done without them (e.g. rounding numbers; yes people do that). It's a lot easier and better to use profiling in general, but that doesn't mean I never see read code and think "hmm that's…

Ok. I'll bite. How do you identify that a performance uplift of part of the code will kill the performance of overall app? Or won't have any observable effect? I'm not saying you can't spot naive performance pitfalls. But how do you spot cache misses reading the code?

For example if someone uses a linked list where a vector would have worked. Vectors are much faster, partly due to better spatial locality.

Re: Look Out for Bugs

#42
post #36

Earlier quoted context omitted.

Ok. I'll bite. How do you identify that a performance uplift of part of the code will kill the performance of overall app? Or won't have any observable effect? I'm not saying you can't spot naive performance pitfalls. But how do you spot cache misses reading the code?

For example if someone uses a linked list where a vector would have worked. Vectors are much faster, partly due to better spatial locality.

Ok (that's a naive performance problem), and you speed that up, but now a shared resource is used mutably more often, leading to frequent locking and more overall pauses. How would you read that from your code?
Post reply on HN