JuliaPy / JuliaPy/PythonCall.jl

reducing allocations when checking python coroutines

未关闭
#283 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Julia
星标
1.1k
派生
86
平均合并
1 天 22 小时
30 天内合并 PR
3

描述

If I do:
```julia
while !Bool(fut.done())
sleep(0.01)
end
```
where `fut` is a future created like:
```julia
aio = pyimport("asyncio")
coro = aio.sleep(1)
loop = aio.Runner().get_loop()
aio.run_coroutine_threadsafe(coro, loop)
```
It allocates linearly the more you sleep.
I tried using a global julia vector `[true]` and updating it in place when the future is done, but it doesn't reduce allocations that much, is there a better way?

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。