coroutine size

190 views
Skip to first unread message

cheng dong

unread,
Jun 15, 2024, 10:23:01 AMJun 15
to golang-nuts
thanks to runtime.newcoro/coroswitch and now we could do more things with coroutine. but it seems every newcoro create a full g which is 448B in size. maybe it is too heavy for a coroutine both in size and in schedule granularity ?

cheng dong

unread,
Jun 15, 2024, 10:24:18 AMJun 15
to golang-nuts
maybe coroutine could be implented inside a g in future hopefully

cheng dong

unread,
Jun 15, 2024, 11:16:02 AMJun 15
to golang-nuts
sorry, i found that 500k stack size might be nesessary for a coroutine, so its not a problem.

cheng dong

unread,
Jun 15, 2024, 11:08:02 PMJun 15
to golang-nuts
ahh, i really want to say is, can golang offer user a stateless coroutine. 

Robert Engels

unread,
Jun 16, 2024, 12:08:27 AMJun 16
to cheng dong, golang-nuts
I don’t think that is possible. You can have stackless coroutines, but if a coroutine has no state at all it would simply be implements as a method call chain without parameters in an executor. I doubt these are very useful. 

On Jun 15, 2024, at 10:08 PM, cheng dong <qq451...@gmail.com> wrote:

ahh, i really want to say is, can golang offer user a stateless coroutine. 
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/1d0dd2db-8890-4adc-894b-40bf0b72c1e4n%40googlegroups.com.

cheng dong

unread,
Jun 17, 2024, 8:53:38 AM (13 days ago) Jun 17
to golang-nuts
stackless coroutine could not be replace by a method call chain, it might have loop and branch etc.
Reply all
Reply to author
Forward
0 new messages