Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance anti patterns

I am currently working for a client who are petrified of changing lousy un-testable and un-maintainable code because of "performance reasons". It is clear that there are many misconceptions running rife and reasons are not understood, but merely followed with blind faith.

One such anti-pattern I have come across is the need to mark as many classes as possible as sealed internal...

*RE-Edit: I see marking everything as sealed internal (in C#) as a premature optimisation.*

I am wondering what are some of the other performance anti-patterns people may be aware of or come across?

like image 586
Xian Avatar asked Jan 08 '09 19:01

Xian


People also ask

What is an example of an anti-pattern?

Poltergeist. A poltergeist is an anti-pattern involving a pointless class that is used to call methods of another class or simply adds an unnecessary layer of abstraction.

Is anti-pattern good?

Anti-patterns are considered bad software design, and are usually ineffective or obscure fixes. They generally also add "technical debt" - which is code you have to come back and fix properly later.

What is meant by pattern and anti-pattern?

A pattern is an idea of how to solve a problem of some class. An anti-pattern is an idea of how not to solve it because implementing that idea would result in bad design. An example: a "pattern" would be to use a function for code reuse, an "anti-pattern" would be to use copy-paste for the same.

What is anti-pattern solution?

A higher-level vocabulary simplifies communication between software practitioners and enables concise description of higher-level concepts. An AntiPattern is a literary form that describes a commonly occurring solution to a problem that generates decidedly negative consequences.


2 Answers

The biggest performance anti-pattern I have come across is:

  • Not measuring performance before and after the changes.

Collecting performance data will show if a certain technique was successful or not. Not doing so will result in pretty useless activities, because someone has the "feeling" of increased performance when nothing at all has changed.

like image 172
Sebastian Dietz Avatar answered Sep 18 '22 16:09

Sebastian Dietz


The elephant in the room: Focusing on implementation-level micro-optimization instead of on better algorithms.

like image 27
dsimcha Avatar answered Sep 20 '22 16:09

dsimcha