JuliaPy / JuliaPy/PyCall.jl

Intern frequently used PyObject?

Abierto
#259 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Julia
Estrellas
1.5k
Forks
186
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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"
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
julia, python
Área
backend, performance
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.