-
Notifications
You must be signed in to change notification settings - Fork 319
Closed
Labels
Description
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:
- The "
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? - generally copying and cloning values - am I copying stuff where I don't have to? In particular, is
inputor parts ofinput(in the case of a dict/list/tuple/set etc.) copied when it doesn't need to be? - Similarly, could we use a
PyObjectinstead ofPyAnyor visa-versa and improve performance? - here and in a number of other implementations of
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 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
RwLockthat 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? - 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"
jorgecarleitao, mrswats, brian-dawn, ZeroCool2u, jaheba and 17 more