54 points · by naish · 18y ago · 40 comments
I had no idea who she was, and now the entire engineering deptartment thinks I'm nuts for her.
But a mapped region certainly can be faster for random access reads from a file. Doing a seek() followed by a read() takes two system calls (and thus four context switches) in addition to any I/O overhead. Faulting the page in from an existing mapping instead takes only one interrupt handler at worst, and potentially completes without kernel intervention at all if the page is already mapped.
I agree in general, but... I have run into a few platform bugs in my time. For example, at one point realloc in the standard C library that came with Visual Studio would break if you (IIRC) allocated a bunch of blocks that were over 16k, and realloced them to be smaller than 16k. And I had to figure that out the hard way, because the bug was making our code crash.
Also, on most game consoles, I'd say about a quarter of the time you think something is a platform bug, it really is. Seriously. Compiler bugs and SDK bugs just aren't all that uncommon there.
Remember that the very first thing you do, when looking
at any bug, before you even start thinking about it, and
long before you look at your code, is replicate it. You
can't debug what you can't replicate, and user reports
are usually lacking in some details that your trained eye
will catch.
So if you don't have a repro, you don't investigate the bug? Not a good way to treat your customers.His point is that you always try to reproduce the bug before you assume you understand it.
His comments don't say anything about what to do if you're unable to reproduce. He's just suggesting in which order he thinks you should take certain actions.
It's altogether too easy to jump straight to a patch, submit it, and miss the forest for the trees because you never actually went through the use flow and realized you were patching a symptom, not the underlying problem.
One will do well to learn debugging things from least amount of information - log files, crash dumps etc. Doing this consistently even for the easy bugs with repro will teach developers to put more information into log files and make data structures easier to discover within dumps. Then once hard problems come you will be ready.
Your first paragraph presents a straw man. Sure, in extreme cases, reproducing a bug is not mandatory. Again, the author does not claim that reproducing a bug is mandatory, but rather that it is a useful practice.
It is not a virtue to try to base your work on the least amount of information.
You say that "when the hard problems come you will be ready". But really when the hard problems come you will look at them assuming that the logged information is enough to solve them. No programmer can know ahead of time what information to log, so by purposefully blindfolding yourself from experiencing the bug directly, you might miss the bigger picture.
Indeed, I can't think of a reasonable logging mechanism that the author could have thought of ahead of time that would have helped with this particular bug. Emphasis on "reasonable".