Anyone interested in coroutines for JavaScript?
dl.dropboxusercontent.com
Anyone interested in coroutines for JavaScript?
1–6 of 6 posts
Re: Anyone interested in coroutines for JavaScript?
#2The fact that console is logging from xfrom y on the same line means both executed at the same time?
Re: Anyone interested in coroutines for JavaScript?
#3The fact that console is logging from xfrom y on the same line means both executed at the same time?
Yeah, they're all executing on different cores.
Re: Anyone interested in coroutines for JavaScript?
#4Re: Anyone interested in coroutines for JavaScript?
#5Earlier quoted context omitted.
Yeah, they're all executing on different cores.
But why then are there skipped (empty) lines on the console (that seem to correspond to the parallel executions)? Strange behaviour.
This happens when there is no synchronization involved, the engine is printing line endings in a separate operation, so they come out weird like that. I'll add a mutex locking mechanism on console I/O at some point in the future.
Re: Anyone interested in coroutines for JavaScript?
#6Earlier quoted context omitted.
But why then are there skipped (empty) lines on the console (that seem to correspond to the parallel executions)? Strange behaviour.
This happens when there is no synchronization involved, the engine is printing line endings in a separate operation, so they come out weird like that. I'll add a mutex locking mechanism on console I/O at some point in the future.
I see. One advantage over web workers is that the DOM would be accesible so this could be used to speed up views rendering.