JuliaPy / JuliaPy/PyCall.jl

convert(Vector{Int}, o) is much slower than copy(PyVector{Int}(o))

未关闭
#90 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
performance
主要语言
Julia
星标
1.5k
派生
186
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

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

调研方向

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.

由索引模型根据 Issue 内容生成。

评估

技术栈
julia, python
领域
performance
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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