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

Comments

4 participants
@jonathanong
Member

jonathanong commented Nov 9, 2013

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

This comment has been minimized.

Show comment
Hide comment
@jonathanong

jonathanong Nov 9, 2013

Member

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

Member

jonathanong commented Nov 9, 2013

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

@tj

This comment has been minimized.

Show comment
Hide comment
@tj

tj Dec 20, 2013

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@jonathanong

jonathanong Dec 20, 2013

Member

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

Member

jonathanong commented Dec 20, 2013

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

@tj

This comment has been minimized.

Show comment
Hide comment
@tj

tj Dec 20, 2013

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@jonathanong

jonathanong Dec 20, 2013

Member

i wish there were no stars anywhere

Member

jonathanong commented Dec 20, 2013

i wish there were no stars anywhere

@tj

This comment has been minimized.

Show comment
Hide comment
@tj

tj Dec 20, 2013

Member

that too

Member

tj commented Dec 20, 2013

that too

@jrpereira

This comment has been minimized.

Show comment
Hide comment
@jrpereira

jrpereira Feb 2, 2014

"i wish there were no stars anywhere"

That really describes the sentiment. :)

"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

use `yield* next` instead of `yield next`
* According to koajs/compose#2, show performances improve a lot.

@coderhaoxin coderhaoxin referenced this issue Sep 23, 2014

Closed

use yield* #5

@andyhu

This comment has been minimized.

Show comment
Hide comment
@andyhu

andyhu 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.

andyhu 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

This comment has been minimized.

Show comment
Hide comment
@jonathanong

jonathanong Jan 30, 2015

Member

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

Member

jonathanong commented Jan 30, 2015

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.