Thread (95 messages) flat view 95 messages, 33 authors, 2016-06-15

Re: On Tabs and Spaces

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:43:42


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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help