I found this "law" somewhere on Wikipedia:

In software engineering, it is often a better approximation that 90% of the execution time of a computer program is spent executing 10% of the code (known as the 90/10 law in this context).

Now I'm interested to find something more about this low (googling, didn't help me too much) like:

  • This law is true in the real sense, or is just an observation, a presumption?

  • If yes, there is a demonstration of this law?

  • And, if possible, can this be proved somehow from a small program?

  • 1
    $\begingroup$ its not a law, more of a trend/empirical observation done through profiling real human-generated code, and has to do with looping, where much execution is inside of loops. theoretically/roughly a TM can be built/constructed that has whatever statistical distribution of state-visit-frequency ("profile") that is desired (and thereby 'violating' the principle). used in eg compiler/cpu design research where it is exploited in optimization strategies. however, a theoretical model: TM run sequence compression $\endgroup$ – vzn Sep 17 '13 at 17:11
  • 3
    $\begingroup$ I think this is more suitable for Computer Science, please see tour and help center. $\endgroup$ – Kaveh Sep 18 '13 at 2:20

This kind of "laws" are usually labelled as Pareto principle, or 80–20 rule:

Answering specifically your question(s)

1) This law is true in the real sense, or is just an observation, a presumption?

  • This law is just an observation, and was explained more formally as a property of exponential distributions or power law. Then the observation is just the assumption that a given process can be modelled by such a distribution.

2) If yes, there is a demonstration of this law?

  • There is no demonstration that the contribution of the code to execution time follow an exponential law, and I think that there are known counter-examples: I remember a talk showing that Linux Kernel's source had a distinct distribution (biased by the proportion of code assigned to drivers).

3) And, if possible, can this be proved somehow from a small program?

  • This is typically shown (not proved, because it depends of the input of your program) via profiling.

Some useful reference and facts

1) Pareto Principle in general

The Pareto Principle is named after Vilfredo Pareto, who introduced it to describe the distribution of wealth (dixit management.about.com, because "twenty percent of the people owned eighty percent of the wealth") in the early 1900s. It has been applied in popular media to describe the state of many other unrelated systems, as for example by Tim Ferriss stating that 20% of your clients generate 80% of your revenue (so that you can afford losing 80% of your clients if it frees time to increase your revenue by 20%). The formal definition from http://www.investopedia.com is "A rule of thumb that states that 80% of outcomes can be attributed to 20% of the causes for a given event."

2) Pareto Principle in Computer Science

The Pareto principle is no more than a particular property of power laws and exponential distributions. Since it has entered the popular culture it has been misused in various ways, I think that researchers prefer to refer define models using power laws and using their properties rather than referring to the Pareto principle and risk being misunderstood. The fact that the only example about computer science in the wikipedia page on the Pareto Principle is 2 lines long and about Microsoft supports this intuition.

3) Pareto Principle on Execution time

Concerning the execution time, I found only a few references to the application you mentioned, i.e. "only a small portion (10%-20%) of the overall code is actually performance critical" on http://programmingopinions.blogspot.com, and even there they do insist that it is a rule of thumb, not a real property (as one would expect). Dixit http://www.codeproject.com, "Although the Pareto principle is frequently mentioned in software optimization discussions, the way this principle affects the optimization process is usually left obscure."

I hope it helps!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.