The goal of this repo is to benchmark the performance and characteristics of different ORMs on Rust
Rust has several different ORMs (Object relational mappings) that make it easy for users to query or write data to their database. Most of the time, these ORMs only support SQL DBs, Prisma being the notable exception.
Some of the more popular ORMs include:
SQLx is another popular option but is not considered an ORM, see here for more details. I may benchmark this as well in the future out of curiosity but for now will not include it.
- Edit the contents of the
src/constants.rs
file to include the absolute filepath of your database - Make sure all of the cargo dependencies are installed
- Run
cargo prisma generate
- Run
cargo build
to build the project - Run
main.rs
. For those unfamiliar with rust you can also do./target/debug/orm_bench
to run the executable.
Depending on what you're changing you may want the Prisma CLI to run db migrations or reset your db (I would install it globally to make your life easier but up to you).
At the moment I have 1 benchmark and it's only on a SQLITE db, looking at the amount of time it takes to perform 10k create / read / delete ops in each of the ORMs that are being benchmarked. Each of the operations are done serially and without concurrent operations.
# Each of the Create / Find / Delete benchmarks below
# were based on 10,000 records being added, found, or deleted
# to a SQLITE DB serially, without any kind of concurrency
# Each record was related to a user, with a GUID as its PK
# and ID. For more info see the prisma/schema.prisma file
Running diesel benchmarks...
Create users elapsed 4.94s
Find users elapsed 110.16ms
Delete users elapsed 3.62s
Running prisma benchmarks...
Create users elapsed 8.53s
Find users elapsed 2.41s
Delete users elapsed 7.40s
Running prisma raw sql benchmarks...
Create users elapsed 3.74s
Find users elapsed 1.38s
Delete users elapsed 3.76s
I hope to add many more benchmarks soon. If you have any ideas please add them to the discussions page on Github!