JuliaPy / JuliaPy/PyCall.jl

Intern frequently used PyObject?

オープン
#259 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Julia
スター
1.5k
フォーク
186
PR マージ指標
30日以内にマージされた PR はありません

説明

While examing the `gc` of my code I saw a LOT of PyObject being created and garbage collected. (I modified `PyCall` so as to print the object at finalizing)

I am wondering if `PyCall` can automatically cache many frequently used objects, such as

```
PyObject([])
PyObject(None)
PyObject(True)
PyObject(False)
```

and maybe even `PyObject(0), ... PyObject(255)`.

For example, I have a [Julia wrapper](https://github.com/colinfang/PyLogging.jl) for python `logging`. Each logging would generate 7 `PyObjects`. That's a bit too many.

```
julia> PyLogging.basicConfig()

julia> @warning logger "ll"
WARNING:root:ll

julia> gc()
"Start pydecref PyObject (30,)"
"Start pydecref PyObject True"
"Start pydecref PyObject 30"
"Start pydecref PyObject 'll'"
"Start pydecref PyObject []"
"Start pydecref PyObject (30, 'll', [])"
"Start pydecref PyObject None"
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。