Archive for the ‘Web Development’ Category

* I’m so lazy…

Posted on July 29th, 2008 by whinger. Filed under Web Development.


So I haven’t blogged for months. Not that I’m exactly inundated with people emailing me every day asking when the next entry will arrive, but even so I feel bad. Why is that? Perhaps because I spent time and effort (albeit not very much) figuring out how to get this to work and setting it up. Maybe because in my heart of hearts I truly believe if I were just to write more, people would understand how urbane and witty my thoughts are and I would be lauded as the next Wilde. Only without the prison bit, obviously.

Anyway, I’ve added a new category – web development – which should a) make my blog more relevant to all you internet geeks (nothing like whoring myself out to the mass market) but b) (and more importantly) really give me something to whinge about.

Currently most of my paid-for development is php and javascript, so you should find some random whinges in here fairly regularly since (as you’ll know if you’ve ever tried them) they’re both highly whinge-worthy. I’ll also probably be whinging about browsers if I’m having a bad day, and there may be the odd post about shellscripts or other Linux/Unix stuff, but the majority of this category will probably fit “web development” best.

I suppose I should have a “meta” category for this type of blog entry, since it’s a blog about the blog. How postmodern.

.



* PHP: long variable names

Posted on July 29th, 2008 by whinger. Filed under Web Development.


edit: as Chris points out in the comments, this doesn’t hold true for php 5.2. Yah, boo. 🙁

So using long variable names in php makes a difference to the speed of your code.

It’s true: try this…

<?
$s=time();
for ($c=0; $c < 100000000; $c++) {
$verylongvariablename++;
}
print time()-$s . "\n";

$s=time();
for ($c=0; $c < 100000000; $c++) {
$a++;
}
print time()-$s . "\n";

?>

This gives me a difference of around 20%.

Of course in the real world you won’t just be incrementing variables in a tight loop so the difference is essentially irrelevant and I wouldn’t recommend anyone starts sacrificing readability by shortening variable names, but I thought it was interesting.

Who knows, you might too 🙂

Tags: .



Blogroll

Categories