I was wondering about the relative merits of these three ways of protecting a
trailing space in a condition from being mistakenly deleted by a human editor
who can't see that it's there:
| > * whatever else[ ]
| > * whatever else( )
| > * whatever else ()
Philip Guenther replied,
| From my looking at the source, the last two should be equal in
| efficiency, and except for a trace differance in regcomp time, should
| match at the same speed as a solitary trailing blank.
That makes sense.
| The character class version "[ ]" will be slower ...
I had a feeling it would be; that's why I asked. Thank you.
| Of course, I suspect that neither you nor your sysadmin will ever
| notice the differance in speed, and given that 99% of all systems are
| I/O bound and not CPU bound, the system is incredibly unlikely to
| notice either. I can't complain though, as I also go to various
| extremes to eek out every last bit of possible performance. Ah well...
It's more a matter of principle and curiosity than anything else. The cycles
we've taken in sharing these three posts with everyone on the list are proba-
bly greater than those saved in ten years' time of using ( ) instead of [ ].
I'd been using
* whatever else[ ]
but I've switched to
* whatever else( )
out of a personal preference based solely on looks over
* whatever else ()
[I think we had established some time back that
* whatever else .*
would be slower yet, though perhaps no slower than the bracket form is.]