The following JavaScript algorithm has a large number of redundant variables, unnecessary logic and inefficient string concatenation.
The same logic can be stated more efficiently as follows:
The difference in code density between various computer languages is so great that often less memory is needed to hold both a program written in a "compact" language (such as a domain-specific programming language, 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.
Some techniques for reducing code bloat include:1
"Code bloat". DocForge. Archived from the original on 5 March 2016. Retrieved 30 December 2009. https://web.archive.org/web/20160305150311/http://docforge.com/wiki/code_bloat ↩