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
- Comprehensive benchmarking of CRUD operations
- Loop-based performance testing
- Detailed timing measurements
- Memory usage tracking
- SQLite database for consistent testing environment
- Install dependencies:
npm install- Generate Prisma client:
npx prisma generate- Run the benchmark:
npm run benchmarkThe benchmark tests the following operations:
- Bulk Insert - Inserting multiple records at once
- Individual Insert - Inserting records one by one
- Select All - Retrieving all records
- Select with Where - Filtered queries
- Update - Updating existing records
- Delete - Removing records
- Complex Query - Joins and aggregations
Results are displayed in the console with:
- Execution time for each operation
- Memory usage statistics
- Performance comparisons between ORMs
- Average times across multiple iterations
├── 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
- Node.js 16.0.0 or higher
- ES2021+ features support