Skip to content
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

promote yield* next instead of yield next #2

Closed
jonathanong opened this issue Nov 9, 2013 · 9 comments
Closed

promote yield* next instead of yield next #2

jonathanong opened this issue Nov 9, 2013 · 9 comments

Comments

@jonathanong
Copy link
Member

it's faster: tj/co#43

at least it'll work with or without it. it's an easy win. testing koa's benchmark, here's loa without yield*:

screen shot 2013-11-09 at 2 36 29 pm

with yield*:

screen shot 2013-11-09 at 2 36 57 pm

only problem is that next() should always return a generator. that's an easy fix.

@jonathanong
Copy link
Member Author

i think the best thing about yield* next is that now next is explicitly a generator.

@tj
Copy link
Member

tj commented Dec 20, 2013

that's not even remotely enough of a gain to worry about IMO, add one console.log() per request and you take a bigger hit. If anything we could improve co's perf by adding a shared scheduler but not a huge deal really. I don't like the context switching between yield and delegation

@jonathanong
Copy link
Member Author

i'm not worrying about it :P it's just free to me.

@tj
Copy link
Member

tj commented Dec 20, 2013

it would kinda almost be nicer if javascript would just auto-delegate when you yield a generator, maybe make yield * the inverse haha.. meh

@jonathanong
Copy link
Member Author

i wish there were no stars anywhere

@tj
Copy link
Member

tj commented Dec 20, 2013

that too

@jrpereira
Copy link

"i wish there were no stars anywhere"

That really describes the sentiment. :)

fengmk2 added a commit to cnpm/cnpmjs.org that referenced this issue Mar 5, 2014
* According to koajs/compose#2, show performances improve a lot.
@dzcpy
Copy link

dzcpy commented Jan 28, 2015

+1
Is there any significant drawbacks when using yield* like memory consumption or cpu usage?
IMO it should be not too hard, and it also has less chance to break something. So hopefully it will be finally changed.

@jonathanong
Copy link
Member Author

there really isn't any downside, but it's probably not worth the cognitive overhead for new beginners, especially with async/await coming along.

@koajs koajs locked and limited conversation to collaborators Jan 30, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants