- Notifications
You must be signed in to change notification settings - Fork3
PHP ORM Performance Analysis: Benchmarking and comparing Doctrine, Laravel, Cycle, and CompositePHP ORMs in CRUD operations on MySQL. Essential insights on speed and memory efficiency for PHP developers.
compositephp/php-datamapper-benchmark
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This repository contains benchmarks for some of the most popular PHP DataMapper's, used as a reference for performanceoptimizations in my personal projectcompositephp/db.
The projects benchmarked include:
- The benchmark executes 10 000 CRUD (Create, Read, Update, Delete) operations to assess the performance.
- The benchmark tests focus exclusively on the 'DataMapper' component of each project, employing simple queries that donot involve relationships, foreign keys, or joins.
Operations include:
- Creating a new record in the database.
- Reading the record by primary key.
- Updating one field for the found record.
- Deleting the record.
- MySQL 8.0
- Table used for the benchmark:
CREATETABLEIF NOT EXISTS Users(`id`INTEGERNOT NULLPRIMARY KEY AUTO_INCREMENT,`name`VARCHAR(255)NOT NULL,`age`INTEGERNOT NULL,`microtime` FLOATNOT NULL,`created_at`TIMESTAMP DEFAULTCURRENT_TIMESTAMPNOT NULL);
| Project | Time (seconds) | Memory Kb | Memory Peak Mb |
|---|---|---|---|
| Laravel Eloquent | 61.51 | 4950.91 | 8.063 |
| Cycle ORM | 44.32 | 288.15 | 7.007 |
| Doctrine | 37.45 | 870.24 | 6.408 |
| CompositeDB | 24.71 | 143.46 | 2.217 |
| PHPFUI ORM | 20.43 | 109.37 | 2.196 |
- PHP 8.1+
- Docker
- Composer
- PDO_MySQL extension
- Clone or download this repository
- Run
composer update - Execute
docker-compose up - Run benchmarks for each DataMapper separately:
php src/test-laravel.phpphp src/test-cycle.phpphp src/test-doctrine.phpphp src/test-composite.phpphp src/test-PHPFUI.php
This is a synthetic benchmark focused on speed and memory consumption and does not compare the feature list of the projects.Feel free to note any problems, inaccuracies, or shortcomings in using these projects and make a pull request to fix them.
About
PHP ORM Performance Analysis: Benchmarking and comparing Doctrine, Laravel, Cycle, and CompositePHP ORMs in CRUD operations on MySQL. Essential insights on speed and memory efficiency for PHP developers.
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.