Shopify/batman — pull request #608 by kristianpd (2012-12-05 05:06:12+00:00)
Title: Avoid event creation on fire

Builds on #605 (ancestor refactor) but mainly touches the fact that we don't need to create `Event` objects for each event being fired if there are no handlers listening.

Issue was noticed when creating 1000 sample `Model` objects and noticing a 16:1 ratio of `Event` objects being created.

These two comparisons, before and after show the `Event` objects being reduced as well as a few other potential candidates.

# BEFORE
![before](http://cl.ly/image/2m1I3o0a3P3U/Screen%20Shot%202012-12-04%20at%2011.45.19%20PM.png)

# AFTER
![after](http://cl.ly/image/1t1Q1G1E0Q1y/Screen%20Shot%202012-12-04%20at%2011.42.49%20PM.png)

### Some measurable improvements

![](http://cl.ly/image/1z3e0u3w1I1P/Screen%20Shot%202012-12-04%20at%2011.55.29%20PM.png)
![](http://cl.ly/image/1t233T1Q1Q0v/Screen%20Shot%202012-12-04%20at%2011.56.46%20PM.png)
![](http://cl.ly/image/3x2r2f3f3o1c/Screen%20Shot%202012-12-04%20at%2011.58.16%20PM.png)
![](http://cl.ly/image/2B3Y2D2X073f/Screen%20Shot%202012-12-04%20at%2011.55.56%20PM.png)
![](http://cl.ly/image/3K2s3E2g1O2g/Screen%20Shot%202012-12-04%20at%2011.56.29%20PM.png)

@hornairs @nciagra @mattwdh thoughts on this approach? I'm going to add a few tests for the new methods tomorrow. Unsure why but command line test suite is failing and browser test suite is working fine.