Opentopia Directory Encyclopedia Tools

Code bloat

Encyclopedia : C : CO : COD : Code bloat


Code bloat is the production of code that is perceived as unnecessarily long, slow, or otherwise wasteful of resources.

Some techniques for reducing code bloat include:

Code bloat can also be caused by inadequacies in the language in which the code is written, or inadequacies in the compiler used to compile the language. An example of this is the template system employed in C++. A naive compiler implementing this feature can introduce versions of a templated function for every type it is used with. This in turns leads to compiled functions that may never be used, thus resulting in code bloat. More sophisticated compilers and linkers detect the superfluous copies and discard them, reducing the bloat.

The difference in code density between various languages is so great that often less memory is needed to hold both a program written in a "compact" language (such as Microsoft P-Code or threaded code), plus an interpreter for that compact language (written in native code), than to hold that program written directly in native code.

There are a few cases where there is a space-time tradeoff -- in those cases, a larger program runs faster than a smaller program. But in most cases, making a program larger will also make it run slower.

See also

 


From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.

Search Titles
0123456789
ABCDEFGHIJ
KLMNOPQRST
UVWXYZ?

E-mail this article to:

Personal Message: