Intern frequently used PyObject?
- Lingua principale
- Julia
- Stelle
- 1.5k
- Fork
- 186
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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"
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Start by inspecting PyCall's PyObject construction and finalization paths, especially the constructors for None, booleans, empty lists, tuples, and small integers. Determine how frequently created objects could be cached without breaking reference management, then verify that repeated logging calls create fewer temporary PyObjects and still finalize safely.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- julia, python
- Ambito
- backend, performance
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100