Skip to content

Latest commit

 

History

History
113 lines (84 loc) · 3.86 KB

File metadata and controls

113 lines (84 loc) · 3.86 KB

ORM Benchmarking Results

Test Environment

  • Node.js Version: v22.14.0
  • Platform: macOS (darwin)
  • Architecture: x64
  • Database: SQLite
  • Test Data: 1000 users per bulk operation, 100 users per individual operation
  • Iterations: 5 per ORM

Performance Rankings

🥇 Overall Winner: TypeORM

TypeORM consistently performed the best across all operations, particularly excelling in:

  • Bulk Insert: 18.67ms average (fastest)
  • Select Operations: 9.76ms for select all, 6.23ms for filtered queries
  • Complex Queries: 0.67ms average (fastest)

🥈 Second Place: Prisma

Prisma showed strong performance in:

  • Bulk Insert: 89.56ms average
  • Update Operations: 9.09ms average
  • Complex Queries: 1.42ms average

🥉 Third Place: Sequelize

Sequelize performed well in:

  • Delete Operations: 7.92ms average
  • Update Operations: 10.06ms average

Fourth Place: Objection.js

Objection.js had the slowest bulk insert performance (5369.22ms) due to SQLite limitations, but performed well in individual operations.

Detailed Results

Bulk Insert Performance

  1. TypeORM: 18.67ms (🥇)
  2. Prisma: 89.56ms (🥈)
  3. Sequelize: 106.76ms (🥉)
  4. Objection.js: 5369.22ms

Note: Objection.js bulk insert is slow because SQLite doesn't support batch inserts, so it falls back to individual inserts.

Individual Insert Performance

  1. TypeORM: 368.60ms (🥇)
  2. Objection.js: 500.50ms (🥈)
  3. Prisma: 578.52ms (🥉)
  4. Sequelize: 584.67ms

Select All Performance

  1. TypeORM: 9.76ms (🥇)
  2. Objection.js: 11.92ms (🥈)
  3. Prisma: 26.38ms (🥉)
  4. Sequelize: 29.00ms

Select with Where Performance

  1. TypeORM: 6.23ms (🥇)
  2. Objection.js: 7.32ms (🥈)
  3. Prisma: 16.26ms (🥉)
  4. Sequelize: 18.12ms

Update Performance

  1. TypeORM: 6.95ms (🥇)
  2. Prisma: 9.09ms (🥈)
  3. Objection.js: 9.93ms (🥉)
  4. Sequelize: 10.06ms

Delete Performance

  1. TypeORM: 6.58ms (🥇)
  2. Sequelize: 7.92ms (🥈)
  3. Prisma: 8.64ms (🥉)
  4. Objection.js: 8.78ms

Complex Query Performance

  1. TypeORM: 0.67ms (🥇)
  2. Prisma: 1.42ms (🥈)
  3. Objection.js: 2.58ms (🥉)
  4. Sequelize: 2.67ms

Graphical Representation Using Average Time Taken

The following histograph represents the time comparison between each ORM for each operation.

Screenshot 2025-08-02 at 22 33 03

Key Insights

  1. TypeORM Dominance: TypeORM consistently outperformed all other ORMs across all operations, making it the clear winner for SQLite-based applications.

  2. SQLite Limitations: Objection.js suffered significantly in bulk operations due to SQLite's lack of batch insert support.

  3. Prisma Efficiency: Prisma showed strong performance in most operations, particularly in complex queries and updates.

  4. Sequelize Consistency: Sequelize provided consistent performance across all operations, though not the fastest in any category.

  5. Raw SQL Advantage: TypeORM's use of raw SQL queries in this implementation likely contributed to its superior performance.

Recommendations

  • For SQLite Projects: TypeORM is the clear choice for best performance
  • For Type Safety: Prisma offers excellent type safety with good performance
  • For Flexibility: Sequelize provides the most features and flexibility
  • For SQL Control: Objection.js offers the most SQL-like query interface

Methodology

The benchmark tests each ORM with:

  • 5 iterations per operation
  • Fresh test data for each iteration
  • Proper database cleanup between iterations
  • High-precision timing measurements
  • Error handling and validation

All tests were conducted on the same hardware and software environment to ensure fair comparison.