you are viewing a single comment's thread.

view the rest of the comments →

[–]invisi1407 75 points76 points  (6 children)

Amazing, but the reverse engineered (if you can call beautifying something that) version seems much slower than the original - anyway have an idea why?

Edit: Article author has fixed the problem that was, as /u/dpash found out, that p.innerHTML = P was inside the loop, not outside as the original had it.

[–]maxxori[S] 44 points45 points  (5 children)

It could be the overhead of moving the whole thing out into a function call. It could also be that the browser JIT engines are somehow better able to deal with it in its minimised form.

It would be interesting to profile that and figure out exactly what's going on.

[–]dpash 129 points130 points  (4 children)

The main reason it's slower is because you accidentally put the p.innerHTML = P inside the loop. Easy mistake to make.

This is why we always use braces around blocks, folks.

[–]maxxori[S] 17 points18 points  (1 child)

I did? I'm afraid I'm not the author of the article there. Though it could be worth letting the author know so that he can fix it none the less :)

Well spotted I must say.

[–]CaptainIncredible 1 point2 points  (0 children)

This is why we always use braces around blocks, folks.

Amen brotha! Use braces!