You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 11, 2026. It is now read-only.
generally copying and cloning values - am I copying stuff where I don't have to? In particular, is input or parts of input (in the case of a dict/list/tuple/set etc.) copied when it doesn't need to be?
Similarly, could we use a PyObject instead of PyAny or visa-versa and improve performance?
here and in a number of other implementations of ListInput and DictInput we do a totally unnecessary map, is this avoidable? Is this having a performance impact? Is there another way to give a general interface to the underlying datatypes that's more performance
The code for generating models here seems to be pretty slow compared to other validators, can anything be done?
Recursive models are slowing than I had expected, I thought it might be the use of RwLock that was causing the performance problems, but I managed to remove that (albeit in a slightly unsafe way) in simplifying recursive references #32 and it didn't make a difference. Is something else the problem? Could we remove Arc completely?
lifetimes get pretty complicated, I haven't even checked if get a memory leak from running repeat validation, should we/can we change any lifetimes?
I'll add to this list if anything else comes to me.
More generally I wonder if there are performance improvements that I'm not even aware of? "What you don't know, you can't optimise"
I'm keen to "run onto the spike" and find any big potential performance improvements in pydantic-core while the API can be changed easily.
I'd therefore love anyone with experience of rust and/or pyo3 to have a look through the code and see if I'm doing anything dumb.
Particular concerns:
cast_asvs.extract" issues described in Add performance suggestions to docs PyO3/pyo3#2278 was a bit scary as I only found the solution by chance, are there any other similar issues with pyo3?inputor parts ofinput(in the case of a dict/list/tuple/set etc.) copied when it doesn't need to be?PyObjectinstead ofPyAnyor visa-versa and improve performance?ListInputandDictInputwe do a totally unnecessarymap, is this avoidable? Is this having a performance impact? Is there another way to give a general interface to the underlying datatypes that's more performanceRwLockthat was causing the performance problems, but I managed to remove that (albeit in a slightly unsafe way) in simplifying recursive references #32 and it didn't make a difference. Is something else the problem? Could we removeArccompletely?I'll add to this list if anything else comes to me.
More generally I wonder if there are performance improvements that I'm not even aware of? "What you don't know, you can't optimise"
@pauleveritt @robcxyz