in reply to cat vs. file handle speed?
None of them have error checks.
Those issues are more important than the miniscule speed differences...
UPDATE
(Response to Adam.)
I find that what people do in pseudo-code, they do in
real code as well. Error checks should be a reflex.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re (tilly) 1: cat vs. file handle speed?
by Adam (Vicar) on Mar 30, 2001 at 06:08 UTC | |
Update | [reply] |
by tilly (Archbishop) on Mar 30, 2001 at 22:58 UTC | |
As for whether $! was a later argument, well I don't think so. You see I am in the habit of giving answers where you are unlikely to see the point of the answer unless you try it. If you try it you will discover that for yourself, and I believe that makes it stick better. If you do not try it, well my typing it wouldn't have helped because you would have just forgotten that as well. So yes, I was attempting to make it clear that dorpus was asking the wrong question. That was not an accident, that was the point. And I think that what I said does help our fellow monks. Why? Because it tells them what I think is important. I believe that if they value what I think is important here, that will be helpful. It may not be the help that was requested, but I am (in case you had not noticed) someone who tries to give the help that I think does the most good, even if it is not the help that was asked for. Furthermore when I first answered I gave concious thought to the question of whether I should answer the question as posed. You see I knew from the start that any of the three could beat the other two in practice. I sincerely thought about saying that up front, but I decided that it would obscure the critical point. And the critical point is that 99.9% of the time this is the wrong question to ask. The remaining 0.1% of the time, if you ask it and think carefully, you will come to the same answer that you would have come to if you had asked the right question in the first place. Therefore I thought it justified to only say what I considered to be key. Which is that until you reflexively get the syntax right and reach for the error check, it is more important to focus on those things than worrying about raw performance. Now if this undermines my credibility, then so be it. And continuing on, you may be different, but I used to claim that I never opened without a die in real code. But first I realized that if I showed my pseudo-code to others I wanted to put the die in so that they would not accidentally copy that. Then one day I caught myself missing that detail converting my own pseudo-code into production code. I then sat back, thought, and made the concious decision to always use it, even in pseudo-code, because I didn't want to accidentally pick up and use bad habits moving to production code. So YMMV, but what I do in pseudo-code I tend to do in production as well. So habits I want to have in my production code I try to stick to in pseudo-code. | [reply] |
by Adam (Vicar) on Mar 30, 2001 at 23:05 UTC | |
As for the amount of details in pseudo-code, all I can say is to each his own, or as LW put it, TIMTOWTDI. It is the wrong place to critique a persons code, because it is not code. If they fail to check a syscall in actual code, then by all means have at them. But pseudo-code isn't code - which is what makes it useful. | [reply] |