Wednesday, March 21, 2007

Agent 55 Merchandise!


Now we have made it possible for our visitors to purchase Agent 55 products. That means that anyone can buy a t-shirt, a mousepad and much more products with the Agent 55 logotype and/or the Agent-silhuettes. We have two different webshops, one for people living in Sweden only (polyshop.se) and one for people living in the USA and the rest of the world (cafepress.com) so feel free to visit them and buy some nice products. I just received our "test"-products yesterday, and I can tell you that the shadow-effect with the silhuettes looks really cool, especially if you take a photo of the product it looks like the shadow of the silhuette gets inside the product in a sort of 3D-illusion. Agent 55 does not make any profit of anything you may buy from these webshops, so the price is as low as its gets. We just think it is nice if anyone in another country would wear a Agent 55 sweater... :)

Visit the Swedish store at polyshop.se/agent55/
Visit the International store at cafepress.com/agent55/

Thursday, March 1, 2007

Textout with PHP, which one is really the fastest?

(This is a bit off-topic from Agent55). The other day I saw a discussion on a forum about what php-code to use if you want your script to be as FAST as possible. The discussion was about whether "print" or "echo" should be used, and I thought that probably the <php ?> tags would be faster to use than either of print and echo.

Which is faster? (With faster I mean the one that executes in less time)

Hi <?=$username?> !!!

or
<?echo "Hi $username !!!"?>

Ofcourse I had to make an empirical test, to know for sure what method was the fastest, So I hacked up these two (in functionality) identical code-snippets.

The "echo-method"

<?$username="test";$time_start = microtime(true);
for($i=0;$i<1000000;$i++){?><?echo "Hi $i $username !!!"?><?}
$time_end = microtime(true);
?><?=($time_end - $time_start)?>


The "inline-method"
<?$username="test";$time_start = microtime(true);
for($i=0;$i<1000000;$i++){?>Hi <?=$i?> <?=$username?> !!!<?}
$time_end = microtime(true);
?><?=($time_end - $time_start)?>


The results
I have tested these two php-snittets in two single php-files on my test-server and the results are conclusive. Not ONCE did the "echo-method" prove to be faster than the inline-method. In my particular test-case, the "inline-method" was around 0.5 seconds faster than the "echo-method"

Conclusion
So what is the conclusion of this then? Well, in a normal php-development case you won't have to care about these two differences because in my test-code I did 1 miljon repeats of the code to get a difference of only half a second between the two, so this is only a test of the principle.

What I do know is that the "inline-method" is a much more appreciated way to create dynamic content, at least by almost any web-designer I have talked to about this.
So now when it proved to be slightly faster than the "echo-method", I see no reason to use the "echo-method" any longer generally speaking, there will always be exceptions to this ofcourse.

What do you think? Feel free to use the code-snippets above to test them on your own server.


Digg!