convert(Vector{Int}, o) is much slower than copy(PyVector{Int}(o))
- Dominant language
- Julia
- Stars
- 1.5k
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
As discussed [on julia-users](https://groups.google.com/d/msg/julia-users/1M8wDT0e5h4/qZ2OPaM9Hi4J), the two pathways to converting a Python list to a `Vector{Int}` seem mysteriously different in performance. For example:
``` julia
iv = PyVector(rand(Int16, 10^6))
@time copy!(Array(Int, length(iv)), iv);
@time convert(Vector{Int}, iv.o);
```
yields 3-5× slower performance for the second version on my machine.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the issue's two benchmarks with a PyVector created from rand(Int16, 10^6): copy! into Array(Int, length(iv)) and convert(Vector{Int}, iv.o). Trace the two conversion paths to identify why their performance differs; done means the slower conversion no longer has the reported 3–5× gap, with the benchmark confirming the result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia, python
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100