Switch Table Extension
July 31st, 2008 | by Stefan Esser |A quite long time ago I stopped blogging in my previous blog at php-security.org because I wanted to move to a new domain to be able to finally blog about other things than PHP (or web application) security. Now after months of silence I start a new blog over here at suspekt.org that will no longer concentrate on PHP security but also cover other topics that interest me.
Today I start with announcing the Switch Table Extension that I released yesterday with a short announcement on the PHP Internals mailinglist. The purpose of this experimental extension is to speed up the execution of repeated switch() statements. To understand how this achieved and why this is necessary read the documentation here.





6 Responses to “Switch Table Extension”
By Ludovic Levesque on Aug 1, 2008 | Reply
Hi Stefan,
I’ve done a little simple benchmark for your readers.
Given this code (switch with 100 integer cases)
http://rafb.net/p/Xh4Uk436.html
Time to do the switches (removing time for the modulo):
- without your extension: average 2.9 s
- with your extension: average 0.08 s
Quite impressive, thanks.
I will test it on some dev servers to see the behaviour on real big code.
By Dieter_be on Aug 1, 2008 | Reply
From a ‘marketing’ point of view, I would keep the php-security blog, just let it be a ‘filtered view’ of this blog (eg show the posts of this blog that are related to php security). (you can always put a link to here). Imho, php-security.org is a good name that attracts new visitors more easily. (If you don’t care about that: fine for me
By underworld on Aug 18, 2008 | Reply
Nice to see a good new domain being used wisely
look forward to reading your stuff in the coming times
By Daevid Vincent on Jan 12, 2009 | Reply
How do I install this? The page and .tgz both give no instructions?!
Also, is there any plans to have this patch/extension incorporated into the real PHP trunk?
By Ralph S. on Aug 8, 2009 | Reply
Just wondering, what version did you check this on? And, do you know of any way for us to know when/if this behavior is included in the PHP release itself?
Thank you.