Skip to content

Erbaz/orm-benchmarking-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ORM Benchmarking Experiment

This project benchmarks four popular Node.js ORMs (Object-Relational Mappers) using SQLite as the database:

  • TypeORM - TypeScript-first ORM
  • Sequelize - Feature-rich ORM with TypeScript support
  • Prisma - Next-generation ORM with auto-generated client
  • Objection.js - SQL-friendly ORM built on Knex.js

Features

  • Comprehensive benchmarking of CRUD operations
  • Loop-based performance testing
  • Detailed timing measurements
  • Memory usage tracking
  • SQLite database for consistent testing environment

Setup

  1. Install dependencies:
npm install
  1. Generate Prisma client:
npx prisma generate
  1. Run the benchmark:
npm run benchmark

Benchmark Operations

The benchmark tests the following operations:

  1. Bulk Insert - Inserting multiple records at once
  2. Individual Insert - Inserting records one by one
  3. Select All - Retrieving all records
  4. Select with Where - Filtered queries
  5. Update - Updating existing records
  6. Delete - Removing records
  7. Complex Query - Joins and aggregations

Results

Results are displayed in the console with:

  • Execution time for each operation
  • Memory usage statistics
  • Performance comparisons between ORMs
  • Average times across multiple iterations

Project Structure

├── package.json
├── README.md
├── index.js              # Main entry point
├── benchmark.js          # Benchmark runner
├── setup.js             # Database setup
├── orms/
│   ├── typeorm.js       # TypeORM implementation
│   ├── sequelize.js     # Sequelize implementation
│   ├── prisma.js        # Prisma implementation
│   └── objection.js     # Objection.js implementation
├── databases/           # SQLite database files
└── prisma/
    └── schema.prisma    # Prisma schema

Requirements

  • Node.js 16.0.0 or higher
  • ES2021+ features support

About

A simple project that compares different ORM libraries in their performance

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published