-
Notifications
You must be signed in to change notification settings - Fork 84
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
Question about coroutine #103
Comments
the wg::WaitGroup is not a may compatible API
…________________________________
发件人: Shundrov Vitaly ***@***.***>
发送时间: 2023年5月21日 8:35
收件人: Xudong-Huang/may ***@***.***>
抄送: Subscribed ***@***.***>
主题: [Xudong-Huang/may] Question about corutine (Issue #103)
I tried to compare the work of the coroutines in golang and "may" library, using the example of simple code that does almost nothing except run these coroutines
In go
`
package main
import (
"sync"
"time"
)
func main() {
var wg sync.WaitGroup
start := time.Now();
for i := 0; i <= 10000000; i++ {
wg.Add(1);
go func() {
wg.Done()
}()
}
wg.Wait()
finish := time.Now();
elapsed := finish.Sub(start)
println(elapsed.Seconds())
}
`
and it take about 3-4 sec
but if i run this
`
#[macro_use]
extern crate may;
use std::time::{Instant};
use wg::WaitGroup;
fn main() {
let wg = WaitGroup::new();
let now = Instant::now();
for _ in 0..10_000_000 {
let co_wg = wg.add(1);
go!(move || {
co_wg.done();
});
}
wg.wait();
println!("{}", now.elapsed().as_secs());
}
`
it take about 60+ sec
maybe I don't understand something or "may" is not designed to run millions coroutines at one time
―
Reply to this email directly, view it on GitHub<#103>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADLGBK7VZ776TKJ6DPTPFW3XHFPNBANCNFSM6AAAAAAYJBIP2Q>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
I would support |
I would like to know, when will we get may::sync::WaitGroup? Thanks. |
Ah, I forgot this task! It should not that hard to implement. |
Thank you for your prompt reply. I see that you are already working on the new feature, such as waitgroup. I really appreciate it. Please notify me once you have completed it. I look forward to using the new version with waitgroup as soon as possible. Thank you. |
just release 0.3.48 |
Thank you very much for your help. I wish you a pleasant day! |
I tried to compare the work of the coroutines in golang and "may" library, using the example of simple code that does almost nothing except run these coroutines
In go
and it take about 3-4 sec
but if i run this
it take about 60+ sec
maybe I don't understand something or "may" is not designed to run millions coroutines at one time
The text was updated successfully, but these errors were encountered: