This repository contains a benchmarking project comparing the performance of various programming languages with MySQL as the backend database.
This project aims to compare the performance of different programming languages when interacting with a MySQL database. Each programming language has been implemented using a simple REST API to retrieve data from the database, and benchmarks have been conducted to measure response times for different numbers of records.
The project is organized into separate folders for each programming language. Each folder contains the code for the corresponding implementation.
expressjs
: Node.js with Express.js frameworkfastify
: Node.js with Fastify frameworkgolang
: Go programming languagelaravel_10
: Laravel PHP framework (Direct DB Access and Eloquent ORM)nestjs
: Nest.js framework for Node.jspython_flask
: Python with Flask framework
- MySQL: The relational database used for storing benchmark data.
- Programming Languages:
- JavaScript (Node.js)
- Go
- PHP (Laravel)
- Python
- Frameworks:
- Express.js
- Fastify
- Laravel
- Nest.js
- Flask
Below are the results of the benchmark tests conducted for each programming language:
Programming Language | Response Time (100k rows) | Response Time (500k rows) |
---|---|---|
Golang | 90 milliseconds | 399 milliseconds |
Laravel (Direct DB Access) | 135 milliseconds | 550 milliseconds |
Express.js | 210 milliseconds | |
Fastify | 198 milliseconds | |
Nest.js | 220 milliseconds | |
Laravel (Eloquent ORM) | 450 milliseconds | 3.0 seconds |
Python (Flask) | 750 milliseconds | 3.56 seconds |
Note: These results are based on testing conducted on a MacBook M1 Pro Max. Your results may vary depending on the specifications and configuration of your system. Different hardware, network conditions, and database configurations can impact performance. Therefore, please interpret these results with that in mind and understand that your experience may differ.
- Navigate to the
expressjs
folder. - Install dependencies using
npm install
. - Start the server using
npm start
.
- Navigate to the
fastify
folder. - Install dependencies using
npm install
. - Start the server using
npm start
.
- Navigate to the
golang
folder. - Build the executable using
go build server.go
. - Run the executable using
./server
.
- Navigate to the
laravel_10
folder. - Install dependencies using
composer install
. - Start the server using
php artisan serve
.
- Navigate to the
laravel_10
folder. - Install dependencies using
composer install
. - Start the server using
php artisan serve
.
- Navigate to the
nestjs
folder. - Install dependencies using
npm install
. - Start the server using
npm start
.
- Navigate to the
python_flask
folder. - Install dependencies using
pip install -r requirements.txt
. - Start the server using
python server.py
.
Contributions to this project are welcome! If you'd like to contribute, please fork the repository, make your changes, and submit a pull request. Be sure to follow the contribution guidelines outlined in the CONTRIBUTING.md file.
This project is licensed under the MIT License.