PHP ORM Benchmarks
How much an ORM costs compared to the queries you would write by hand. Every ORM runs the same scenarios on the same data, and every result is divided by the time of hand-written PDO measured on the same machine in the same run: 3.0× means three times slower than plain PDO.
The numbers come from php-testo/benchmarks-orm. Each release of that repository benchmarks the ORM versions it pins and publishes the run here, so you can go back to any earlier run and see how the ORMs changed between versions.
Versions under test
- Cycle DataMapper
2.19.1was 2.19.0 - Cycle ActiveRecord
1.2.1 - Doctrine ORM
3.8.0 - Eloquent
13.45.0 - Yii ActiveRecord
1.1.0
Machine: SQLite 3.45.1 · AMD EPYC 7763 64-Core Processor, 4 cores · ubuntu24 20261122.23.1 · PHP 8.5.13
Overall
Geometric mean of the time relative to hand-written PDO across all scenarios. Lower is better.
Scenarios
Hover a scenario to see what it does, a cell for the time per operation, its spread and the peak memory. The best result in each row is bold.
| Scenario | PDO | Cycle DM | Cycle AR | Doctrine | Eloquent | Yii AR |
|---|---|---|---|---|---|---|
| Reads | ||||||
| Find by primary key | 3.8 µs | 23.8× | 29.9× | 33.3× | 47.1× | 26.5× |
| List of 10 rows | 18.4 µs | 10.4× | 12.7× | 14.6× | 15.7× | 9.7× |
| List of 100 rows | 151 µs | 6.0× | 7.0× | 7.7× | 7.9× | 4.7× |
| List of 1000 rows | 1.49 ms | 4.5× | 5.2× | 5.9× | 4.5× | 2.8× |
| 100 rows fetched again | 151 µs | 3.7× | 3.6× | 5.2× | 7.9× | 4.7× |
| 100 rows as arrays | 47.9 µs | 9.0× | 10.1× | 12.2× | 8.6× | 13.0× |
| Relations | ||||||
| Eager belongs-to, 100 posts | 225 µs | 9.7× | 10.5× | 7.5× | 12.4× | 5.8× |
| Eager has-many, 20 users | 457 µs | 5.8× | 6.2× | 6.3× | 7.2× | 3.9× |
| Lazy belongs-to, 100 posts | 220 µs | 9.0× | 9.9× | 11.6× | 63.2× | 29.0× |
| Bulk | ||||||
| All 10 000 posts | 16.24 ms | 4.9× | 5.5× | 5.7× | 4.3× | 2.8× |
| Writes | ||||||
| Insert 100 users | 396 µs | 14.5× | 31.5× | 9.9× | 36.1× | 16.3× |
| Insert 20 users + 100 posts | 558 µs | 12.9× | 17.9× | 8.6× | 33.5× | 14.2× |
| Update 100 users | 299 µs | 22.2× | 42.8× | 11.5× | 46.5× | 14.1× |
| Delete 100 posts | 306 µs | 15.0× | 32.6× | 11.4× | 24.2× | 8.3× |
Head to head
How many times one ORM is faster than the other in each scenario.
Across databases
Time of one ORM divided by the time of PDO on the same database. The cost of the ORM itself barely depends on the database, so the columns show which database is faster: the larger the number, the smaller the share of the database query.
| Scenario | SQLite (in memory) | PostgreSQL | MySQL |
|---|---|---|---|
| Find by primary key | 23.8× | 1.8× | 2.1× |
| List of 10 rows | 10.4× | 2.1× | 3.1× |
| List of 100 rows | 6.0× | 3.1× | 3.8× |
| List of 1000 rows | 4.5× | 2.8× | 3.0× |
| 100 rows fetched again | 3.7× | 2.0× | 2.1× |
| 100 rows as arrays | 9.0× | 2.5× | 3.3× |
| Eager belongs-to, 100 posts | 9.7× | 3.2× | 5.1× |
| Eager has-many, 20 users | 5.8× | 3.0× | 3.4× |
| Lazy belongs-to, 100 posts | 9.0× | 2.1× | 2.4× |
| All 10 000 posts | 4.9× | 3.1× | 3.4× |
| Insert 100 users | 14.5× | 1.5× | 1.7× |
| Insert 20 users + 100 posts | 12.9× | 1.5× | 1.7× |
| Update 100 users | 22.2× | 1.8× | 2.0× |
| Delete 100 posts | 15.0× | 1.6× | 1.7× |
Memory
Peak memory of the process loading all 10 000 posts.
How it is measured
- Same data. 1000 users with 10 posts each. SQLite lives in memory; PostgreSQL and MySQL run as services next to the runner.
- Same work. Before measuring, every ORM is checked against PDO: the same rows loaded, the same rows written, everything rolled back.
- Isolated processes. Each ORM has its own Composer project, and PHPBench runs every iteration in a fresh process with OPcache on. The time shown is the mode of the iterations.
- Fair baseline. PDO runs next to every ORM on the same runner; the baseline is the median of those runs, so one noisy run can't skew the ratios.
- Writes leave no trace. Inserts, updates and deletes run in a transaction that is rolled back.
- GitHub-hosted runners. Absolute times move between runner machines; compare ratios rather than microseconds across runs.
The scenarios, the entity mappings and the exact settings are in the repository. Spotted something unfair to one of the ORMs? Open an issue.