-
Notifications
You must be signed in to change notification settings - Fork 570
Curious performance difference between callbacks and promises #579
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
Comments
After seeing @neelance's comment today about his scheduler branch, I re-ran these benchmarks against that branch, and saw apparent improvements for callbacks, and drastic improvements for promises!
Promises are still a bit slower than callbacks, but now the difference is small enough it seems reasonable to assume it's just the difference in JS overhead. I don't know why it makes such a difference; I don't see anything in the commits on that branch that to my reading should relate specifically to promises, but it's encouraging to me nonetheless. |
The main difference is that I eliminated I'm happy to hear that it also improved the benchmarks here. Does everything else work fine for you with that branch? Could we close this issue after merging? |
I've been using the scheduler branch for my regular development/testing work today (~3 hours of dedicated human time), and no problems so far in either Chrome or node. 👍 I see no reason to leave this issue open once that's merged. |
Sounds good. Merged. |
Uh oh!
There was an error while loading. Please reload this page.
All of the benchmarks mentioned below, and a full description can be found here.
I'm experiencing some performance issues with my GopherJS PouchDB bindings, so this morning I wrote some benchmarks, and found that Promises seem to have 100~200x the overhead of callbacks:
In the spirit of @r-l-x's benchmarks on PR #558, I added two more tests, to benchmark only the channel operations:
Of particular note, the code between
b.StartTimer()
andb.StopTimer()
is identical in both tests:Yet the results are drastically different (by a factor of ~200x):
So I then added
BenchmarkChannel
, andBenchmarkChannelInGoroutine
:With the following results:
This seems intuitive to me, and aligns with the result of
BenchmarkRawCallback
. So why the drastic difference with Promises?What am I overlooking? Is there a reason to expect this disparity?
The text was updated successfully, but these errors were encountered: