What would solutions that use coroutines or async/await be considered as? #553
Replies: 2 comments
-
I believe singlethreaded-based coroutines could only have speedup if there’s some kind of I/O blocking operation. That’s how NodeJS gets its performance — there is some sort of multithreaded behavior happening, but it’s outside your code. That solution only sees wins if the file system or network or other resources allow you to do other JS while it’s waiting. This algorithm is computation-based, and generally not I/O based, so I don’t believe you’d see speedup from async/await on such a language, so if you do, I’d count it as multithreaded, and if you don’t see speedup, it’s probably single threaded 😉. Either way I’d love to explore any samples you produce that have interesting behavior! |
Beta Was this translation helpful? Give feedback.
-
@Prasantacharya and @fbartho I'm converting this to a Q&A topic in Discussions, which is what it should be. |
Beta Was this translation helpful? Give feedback.
-
So if someone were to write a solution that utilized co-routines (say in a language like lua, or something like async/await in nodejs or python), would that be considered a multi threaded solution? From what I understand, these arent technically multi threaded, since all the computation is happening one one thread, but they can have a similar speed up to actual multi threaded implementations.
Beta Was this translation helpful? Give feedback.
All reactions