fn main():
async fn my_async_fn() -> Int:
sleep(2)
return 5
fn my_sync_fn():
let my_coro: Coroutine[Int] = my_async_fn()
print(my_coro())
fn call_em_together():
_ = my_sync_fn()
_ = my_sync_fn()
fn call_em_coroutine():
let my_coro_1: Coroutine[Int] = my_async_fn()
print(my_coro_1())
let my_coro_2: Coroutine[Int] = my_async_fn()
print(my_coro_2())
# fn call_em_parallel():
# parallelize[my_sync_fn](2)
let ns = time_function[call_em_together]() # do the same for other two
print(ns)
fn main():
async fn my_async_fn() -> Int:
sleep(2)
return 5
fn my_sync_fn():
let my_coro: Coroutine[Int] = my_async_fn()
print(my_coro())
fn call_em_together():
_ = my_sync_fn()
_ = my_sync_fn()
fn call_em_coroutine():
let my_coro_1: Coroutine[Int] = my_async_fn()
print(my_coro_1())
let my_coro_2: Coroutine[Int] = my_async_fn()
print(my_coro_2())
# fn call_em_parallel():
# parallelize[my_sync_fn](2)
let ns = time_function[call_em_together]() # do the same for other two
print(ns)