PEAR & Efficiency = Crap
I needed to convert times from different timezone. Now, I could hack together something, like I usually do, but I decided to try to make my life easier.
First, I found some timezone PHP script that amount to nearly 800 lines + 75 entries into a database, which also happened to be easily SQL Injectable. Great, this wasn't going to work.
Next up, PEAR. This Date package looks promising. Can convert times from timezones easily, and DST seems to work. It was all looking good. Even after a few hacks to get it to work right, everything was good, until I looked at the generating time.
It was at .085 seconds, up from .025 s. That's a 340% increase. That's not going to work. I was just using it's my own timer using microtime and didn't try http_load, but the results were pretty damn consistent. You might think that it's only 60 ms, but I always think about security and efficiency when making something. If it ever happens to get a lot page views, hopefully I can operate with less server power or not face scalability problems like Twitter.
All of the added time is from including this big ass class. The Date.php and it's four sub files account to about 350 KB. All the files that are running my whole site are only 214 KB, which includes CSS, Javascript (with prototype.js), templates, and so on. Now, it does have a lot of documentation, but still, damn!
Another ridiculous thing, it decided to redefine the formating characters. Instead of following whats already used for date, it decides to just go through the alphabet. I'm sure there's some methodology going through it, but I sure as hell don't see it, except that M/m and H/h are minutes and hours respectively.
So now I've wasted 30 minutes fangling with 2 scripts, and both suck. Plus I've spent another probably 15 minutes writing my disgust with these 2 scripts. I could've just written the damn thing myself already, probably by just slightly modifying this.