JuliaPy / JuliaPy/PythonCall.jl
reducing allocations when checking python coroutines
- Dominant language
- Julia
- Stars
- 1.1k
- Forks
- 86
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 3
Description
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?
Contributor guide
No contributing guide indexed for this repository
Research direction
No repository file or test is named. Reproduce the polling example using asyncio Future.done(), Runner().get_loop(), run_coroutine_threadsafe(), and Julia sleep(), then measure allocations. Done means finding a supported approach whose allocations do not grow linearly with repeated sleeps and documenting or testing that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100