3 ms·
Can you provide a good cheap thread example for Java vs async/await. What I find online is horrible compared to async/await but people keep talking about functi
by tluyben2 4y ago
Can you provide a good cheap thread example for Java vs async/await. What I find online is horrible compared to async/await but people keep talking about function colouring etc. I just cannot see what is the issue. Nor do people give better examples; I was watching some guy on YouTube who said async/await sucks and my idea is better, then spent 30 minutes explaining his idea vaguely. No implementation, no examples.
- nlitened 4y agoIn the simplest case, you take an async function, remove `async` and `await` keywords, and as a result you get a normal function which you can call and get a result without awaiting, which has better and more predictable performance, and a straightforward stack trace (and a simpler language syntax and semantics). All upsides, no downsides. Probably you can think of a more complex example where it’s not that straightforward, please link code that you have in mind, we can see how with cheap threads it could be made better.