This page looks best with JavaScript enabled

[MECpp]Item-16 Remember 80-20 Rule

 ·  ☕ 1 min read · 👀... views

The 80-20 rule states that 80 percent of a program’s resources are used by about 20 percent of the code.

  • 80% of the runtime is spent in approximately 20% of the code
  • 80% of the memory is used by some 20% of the code
  • 80% of the disk accesses are performed for about 20% of the code
  • 80% of the maintenance effort is devoted to around 20 percent of the code

To locate the critical pockets of code that are causing the problem, we should use the right way: using profilers.

  • we want profilers the directly measures the resources we are interested in (how much time is being spent in different parts of the program)
  • knowing how often statements are executed or functions are called may sometimes yield insight into what our software is doing
  • feed the profiler with representative input data - profiler can only tell how a program behaved on a particular run
Share on
Support the author with