ybogdanov / node-sync

Write simple and readable synchronous code in nodejs using fibers
MIT License
491 stars 70 forks source link

The benchmark #12

Closed scriby closed 12 years ago

scriby commented 12 years ago

I was looking at the benchmark provided comparing Sync and the event loop.

I'm not sure if this is intentional, but it's pretty unfair. The majority of the time spent in the event loop solution will be because of the process.nextTick. To really get a good comparison you should move the nextTick into the sum function.

Here's my results with the change (running in a VM):

Event-loop took 3741 ms Sync took 18942 ms

And my results with the original code:

Event-loop took 3772 ms Sync took 7897 ms

ybogdanov commented 12 years ago

I've fixed the benchmark script, you can check it out: 14b2deb93e0b5a2eb02650f99a97f4237e4e0ceb My result:

Event-loop took 219 ms
Sync took 673 ms

But how did you got 3741 vs 18942? Can you please show me the source of your benchmark?

ybogdanov commented 12 years ago

Hey, check out new results 88e5e7659be25f9ddfa14da2bc9ca674cee6f0ac