Shopify/batman — pull request #352 by hornairs (2012-03-06 18:31:30+00:00)
Title: "The Event Horizon": Event handlers in arrays and events in objects

@jamesmacaulay, @nciagra take a quick gander please.

Two major changes here:

- Switches `Event::handlers` to be an array instead of a `SimpleSet`
- Switches the storage mechanism for Events on BatmanObject and Property to be in a POJO instead of a SimpleHash, deciding that Events can only have string names.

Event firing gets faster:

[![][1]][1]

And way less overhead is used for attaching observers and handlers to objects:

[![][2]][2]

The above graph shows the memory usage as we instantiate BatmanObjects each iteration. In first graph, thats all that is done, but in the second, we attach an observer and an event handler to each object. We see that the changes reduce the amount of memory this attachment takes by something like 50%. The memory used remains consistent for the first graph as is expected, since no events are created.

[1]: https://img.skitch.com/20120306-8cbbeptnq4ysdtgp8x5pr7gsak.jpg
[2]: https://img.skitch.com/20120306-8jsy8espab8jmbpna16yffs8tm.jpg