Re: On Tabs and Spaces
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Oct 18, 2007, 00:59 UTC
- Message-ID
- <alpine.LFD.0.999.0710171753020.26902@woody.linux-foundation.org>
- In-Reply-To
- <20071018003256.GA5062@coredump.intra.peff.net>
On Wed, 17 Oct 2007, Jeff King wrote:
> > In what way does an all-space model cause people to accidentally add > tabs, but an all-tab model does not cause people to accidentally add > spaces?
It happens. We do de-spacification in the kernel occasionally when it is an annoyance. Usually it shows up in patches, though - exactly because code which adds spaces instead of tabs won't line up correctly in the diff.
So it doesn't matter *which* one you use (all spaces or all tabs) in that sense. But clearly tabs are *way* more common at least in any UNIX project, and tabs really do have the advantage of being smaller.
And smaller *is* faster. Do something like this on the kernel:
GIT_PAGER= time git grep sched_fair
and then do the same thing with the kernel sources blown up by 20% by de-tabification. Guess which one is 20% slower?
And whoever said that disk space doesn't matter doesn't know what he is talking about. Disk space most *definitely* matters. Do the above test with a cold-cache case, and think what 20% more IO does to you (or 20% less disk cache).
But no, the size issues are secondary, I'm not claiming anything else. Although I do suspect that historically, they have been primary, and have been the thing that has resulted in the fact that tabs are so commonly used.
Linus