2011.09.10

Benchmarking is hard

I’ve seen a lot of people creating benchmarks that are misleading and sometimes I even create some “biased” benchmarks myself. On this post I will try to explain how measuring things the wrong way can make you believe that a certain technique is faster but in real-life applications it may have the opposite effect or not so significant gains.
Read more…


2010.12.08

Using integers to store multiple boolean values

Before starting I have to say that I come from a design background and not so long ago I didn’t knew anything about bitwise operations, in fact I didn’t even knew that it existed, the content described on this post should be trivial for developers coming from a computer science background or low-level languages…

The intention of this post is not to teach what each bitwise operator does, in fact I’m going to explain how to use it without telling what it does since I think it may be easier to understand. The main reason for writing this post is because I had to explain this technique to a couple of different friends over the past years (or at least I tried…) and also because I believe that most front-end developers don’t know about it.

I think I’ve learned it around 3 years ago when I was planing to code a multiplayer RPG game with a couple of friends and was doing some research about ways to optimize data transfer, that was probably the first time I saw a real use for bitwise operations on high-level programing besides splitting color channels…
Read more…


2010.10.04

The performance dogma

On the past couple years I’ve been noticing that the web community (specially front-end devs) started to become more interested and to care way more about performance, trying to make applications load and execute as fast as possible. I think it was mostly influenced by Steve Souders High Performance Website and Yahoo’s Performance Rules.

Performance is a very important topic, which can directly influence the success/fail of an application, but I do believe that some people are getting things wrong and exaggerating a little bit (including myself)… – Of course everybody wants their applications to run and load as fast as possible but “optimizing” things without need is simply wrong. A common quote about performance explain this:

We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%. A good programmer will not be lulled into complacency by such reasoning, he will be wise to look carefully at the critical code; but only after that code has been identified” – Donald Knuth

Read more…


2010.09.28

The lost art of delegating click events on the iPhone

Today I saw on Peter-Paul Koch blog that event delegation for click events on <div> elements doesn’t work properly on the iPhone. Strangely enough, I’ve implemented it 4 days ago (as you can see on this commit) without ever experiencing any kind of problem, that made me insanely curious/scared, specially since I wasn’t doing anything special/different than him and I couldn’t understand what I was doing right/wrong…
Read more…


2010.08.29

Fast Duff’s Device

This week I’ve sent some links about common techniques to improve code performance to the FlashCodersNY mailing list and after sending a link about the Duff’s Device and the Fast Duff’s Device I got really curious if the performance could be improved with simple changes so I decided to do some benchmarks…
Read more…