baconjs/bacon.js — pull request #370 by lautis (2014-05-08 14:30:06+00:00)
Title: Use more thin arrows and prototype methods

Chrome doesn't seem to do a very good job in cleaning up Bacon objects. Glitch-free updates have made this worse, but we've noticed the issue with 0.6 too. While looking for the root cause of the issue, I did some yak shaving to remove CoffeeScript fat arrows.

Using thin arrows reduces memory footprint when you have a large amount of streams. Similarly using prototypes more extensively allow more efficient JIT optimisation. With Flowdock, JS heap is consistently smaller. Bacon performance tests run also slightly faster.

| With thin arrows || |
| ------------- |---------------| ------------------------|
| diamond | 34.51 ops/sec | ±6.29% (47 runs sampled)|
| combo | 54.36 ops/sec | ±7.44% (51 runs sampled)
| zip | 2,054 ops/sec | ±3.81% (82 runs sampled)
| Bacon.combineTemplate.sample | 444 ops/sec | ±3.86% (83 runs sampled)
| Bacon.combineTemplate (deep) | 24.20 ops/sec | ±3.18% (45 runs sampled)
| Bacon.combineTemplate | 281 ops/sec | ±2.95% (86 runs sampled)
| EventStream.map | 4,379 ops/sec | ±4.04% (81 runs sampled)
| EventStream.scan | 3,798 ops/sec | ±3.92% (75 runs sampled)
| EventStream.toProperty | 3,820 ops/sec | ±3.76% (80 runs sampled)

| Master | | |
| ------------- |---------------| ------------------------|
diamond | 28.18 ops/sec | ±4.46% (41 runs sampled)
combo | 43.30 ops/sec | ±7.91% (40 runs sampled)
zip | 1,985 ops/sec | ±4.07% (83 runs sampled)
Bacon.combineTemplate.sample | 420 ops/sec | ±4.36% (78 runs sampled)
Bacon.combineTemplate (deep) | 23.11 ops/sec | ±4.72% (44 runs sampled)
Bacon.combineTemplate | 280 ops/sec | ±3.19% (82 runs sampled)
EventStream.map | 4,072 ops/sec | ±3.91% (80 runs sampled)
EventStream.scan | 3,796 ops/sec | ±3.77% (74 runs sampled)
EventStream.toProperty | 3,855 ops/sec | ±3.71% (81 runs sampled)