-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance testing #56
Comments
Like to start this using https://github.com/bestiejs/benchmark.js, think the easiest is to start with test for node. |
Ok, first performance test added in acf8dee. Should add more cases there and then we can experiment with internal changes and see how the affect performance. Some optimization ideas:
The combination of these two changes might give a huge improvement in cases where a property is combined from a number of inputs but the value is actually used only when sampled by a stream. I have this case at work so this is relevant to my interests. |
Well, with those optimizations the performance benchmark went from 120 to 150 ops per second, which is not a huge improvement. |
Some more tweaking got me to 160 ops per second. This is all in the optimization branch. Feel free to do some tuning and see if you can get the metrics up. You can run the benchmark by
Remember to run tests too, to make sure you don't break it :)
|
Note: I'm running the benchmark on an old MBP. Each "op" in the ops per sec is actually 100 events pushed to each of the 5 Buses that are hooked up into a combineTemplate/sampledBy system. |
Anyone doing optimizations might find chrome's console.profile and On Tue, Jan 29, 2013 at 3:02 PM, Juha Paananen [email protected]:
|
Added some more perf test cases. Bacon.combineTemplate.sample = complex combineTemplate, samples on every 10th change It seems that the optimizations (lazy etc) improves speed in the complex sampled case by more than 30%, and reduces speed in simpler cases by less than 5%. I might opt for including the performance adjustments as (for me) it's a common case to sample a complex compound Property quite seldom. ResultsMasterBacon.combineTemplate.sample x 120 ops/sec ±4.39% (62 runs sampled) OptimizationBacon.combineTemplate.sample x 161 ops/sec ±4.54% (58 runs sampled) |
Optimized Dispatcher.push by removing anon functions defined inside that function. New results: Bacon.combineTemplate.sample x 200 ops/sec ±4.53% (71 runs sampled) |
Oh, there was a gorilla in the room. Removed assertions from event dispatching and got Bacon.combineTemplate.sample x 328 ops/sec ±5.09% (65 runs sampled) |
Finally pushed the improvements to master. |
Closing for now. Running perf tests in actual browsers would make sense though. |
No problems with performance so far, but it might still be interesting to see how many events a sec you can pump through a bacon system like
src.filter(f1).map(f2).flatMap(f3)
Having that metrics established it would be possible to tweak the fat out of it. If we did this with as many browsers as possible, we'd also know something about browser compatibility. But a command-line node-based metric would be a good start.
The text was updated successfully, but these errors were encountered: