Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance Implications of Using Spaces Instead of Tabs for Indentation

Tags:

People also ask

Should I use tabs or spaces for indentation?

I use the following rule and I suggest it for all people free to choose their own coding standards: Indent code but never horizontally align code in any other way. After indentation, never put 2 spaces together (except inside a comment block or string literal) and never use a tab character at all.

Why would you use spaces instead of tabs?

Tabs Debate. Pro-spaces programmers argue that using the space bar makes the layout more flexible. However, pro-tabs users rebut saying tabs makes code more readable and aesthetically pleasing.

How many spaces are used for indentation and is preferred by using tabs?

Four spaces should be used as the unit of indentation. The exact construction of the indentation (spaces vs. tabs) is unspecified. Tabs must be set exactly every 8 spaces (not 4).


I currently use soft tabs (i.e. spaces) for indenting my Ruby code, if I were to use hard tabs would it increase the performance when the code is interpreted? I assume it's faster to read one tab character than parse 4 space characters (however negligible).