December 2008

which statement is faster, elseif() or switch() ?

Tags:

A couple of days ago I was out on a run and I starting wondering which statement was faster, a elseif() or a switch().  I am a big fan of switch statements.  I like how clean they look and its really easy to add a new condition to them.  I also assumed that they were much quicker than elseif statements.  So I set up this test to try to prove to myself that I was right.

Code and Content Copyright 2010, Jesse Baird.