4 ms·
I haven't written benchmarks yet but it is something I am working on. The reason that performance is mentioned in the README is that I haven't spent time on imp
by probablyrobert 5y ago
I haven't written benchmarks yet but it is something I am working on. The reason that performance is mentioned in the README is that I haven't spent time on improving it yet.
The biggest blockers in terms of performance are:
- Communication with the internal Rust engine is performed over HTTP instead of FFI.
- You cannot select a subset of fields (every scalar field in a model is selected)
- You cannot skip pydantic validation which while fast is unnecessary in some cases
With that said Prisma Python should be reasonably fast but I would expect it to be on the lower end of the spectrum compared to other Python ORMs. I have ran some load tests locally and creating 500,000 records took about 90 seconds.
- anentropic 5y agoWhat is the Rust engine doing here? How come GitHub doesn't highlight any Rust code in the project repo?
- probablyrobert 5y agoBecause Prisma Python currently interfaces with the Rust engine over HTTP (I am looking into changing this) and the Rust engines can be found here: https://github.com/prisma/prisma-engines https://github.com/prisma/prisma-engines
- bb88 5y agoGiven the state of PyPi these days and third party packages, I would just prefer to have pure python, even if it is slower. It means I don't have to worry about things breaking on cross compilation between mac/windows/linux.
- probablyrobert 5y agoNo need to worry, the current behaviour will be preserved :) The method used to interface with the internal engine will be able to be configured in the schema: https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#fields-1 https://www.prisma.io/docs/reference/api-reference/prisma-sc...
- joshribakoff 5y agoPrisma uses rust for two main reasons from what I understand. 1) to keep the engine portable and maximize code reuse, to make projects like this Python adapter possible for example 2) under the hood Primsa does not use joins. It does a waterfall of queries (but not n+1), then stitches the data together in memory, which happens in the rust engine for performance reasons