maroslaw/rainyday.js — pull request #29 by aslushnikov (2013-09-25 12:20:26+00:00)
Title: Rendering perf speedup

### Overview
This pull request is aimed towards speeding up rendering performance.
Currently, the implementation degrades performance over time. Here's the screenshot of Chrome DevTools timeline:
![regression](https://f.cloud.github.com/assets/746130/1208760/c07c6074-25d9-11e3-968c-8a437e9602d0.png)
This pull request makes it look like the following:
![speedup](https://f.cloud.github.com/assets/746130/1208759/c07b0364-25d9-11e3-941e-0ec7f0ca98ac.png)
(All measurements are done on MacBook Air 13" 2011)

### In-depth
There are two optimizations (one optimization per commit) in this pull request.
- First [optimization](ca10e0b) moves `requestAnimationFrame` calls from being drop-specific to engine-specific. This change is motivated by timeline's inspection as it became overwhelmed with `requestAnimationFrame` calls over time.
- Second [optimization](0df455f) was motivated by profiler, which showed that `drawImage` was the most time-consuming call with about `27%` share. The change reduces the size of reflected canvas up to 100 pixels so that subsequent calls to `RainyDay.prototype.REFLECTION_MINIATURE` have less pixels to scale down. This resulted in `8%` share for `drawImage` calls.

All in all, thanks for the great visual effect you've done :)