Managing array memory
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- julia
調査の方向性
まず、既存の unsafe_wrap、unsafe_pointer_to_objref、Base._growend!、Base.arrayset! インターフェースと、ベクトルでの resize! の使用方法を確認します。十分に汎用的なインターフェースによって、効率的な拡張、縮小、割り当てを公開できるかどうかを判断し、そのうえで具体的なスコープと実装方針を文書化します。
索引モデルが issue の本文から書いたものです。
説明
The formal interface for working with an array's memory is currently very limited. We mostly just have ways of accessing preallocated memory (e.g., unsafe_wrap and unsafe_pointer_to_objref). The rest of the time we need to rely on methods like push!/pop!/append!/resize to mutate a Vector down the line. Likewise, if we want to allocate memory for a new array we typically need to wrap a new instance of Array.
A couple reasons we this would be good to have here
- Performance. The necessity to ensure that memory is safely managed also means that each call to something like
resize!has to ensure that we don't create a situation where we are out of bounds. This probably only has minimal overhead in most cases but if we are doing something complicated like merging and or sorting two vectors then we may be callingresize!a lot. I recall this sort of thing coming up a lot when I was trying to work with graph algorithms last year that do a lot of insertion and deletion. - Necessary for creating some interfaces. One of the things that makes the indexing interface so nice is that there are formally defined places for new types to insert and propagate information (e.g., bounds checking). It also makes it easier to optimize indexing. In contrast,
Vectordirectly uses methods that allocate and write to memory (e.g.,Base._growend!andBase.arrayset!) while abstract types typically hope thatresize!works and then usesetindex!.
From where I'm standing it seams like this would be great to have here. The reason this is an issue instead of a PR is mainly because I'm unsure if the implementation for this would be too general or involved for this package. We could always define several methods here like unsafe_grow_end! and unsafe_shrink_end! but these aren't super helpful without implementations that can interact with pointers and references.
@chriselrod, do you think growing/shrinking/allocating memory in an efficient way would require a bunch of LLVM magic or could we do it pretty simply here?
- 主要言語
- Julia
- スター
- 140
- フォーク
- 44
- 平均マージ
- 4日 14時間
- マージ済み PR(30日)
- 5
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaArrays/ArrayInterface.jl のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
JuliaArrays/ArrayInterface.jl#499 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
JuliaArrays/ArrayInterface.jl#463 · コメント 5 件 · リアクション 4 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
JuliaArrays/ArrayInterface.jl#460 · コメント 8 件 · リアクション 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
JuliaArrays/ArrayInterface.jl#397 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
JuliaArrays/ArrayInterface.jl#396 ·
JuliaArrays/ArrayInterface.jl の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
CliMA/Oceananigans.jl#6066 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
JuliaLang/LinearAlgebra.jl#1707 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
JuliaAstro/AstroImages.jl#140 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 90/100