ML.

Benchmark

What Does Active Record Build on Every Request? Measured the Same Way as Sequelize and GORM

The last post concluded that Ruby is not slow and that most of a Rails request is Active Record. This one compares what Active Record does per request with Sequelize and GORM, by reading the source and measuring. Most of the cost comes from a has_and_belongs_to_many preload that turns every join row into a full record, and there is a way to cut it sharply while keeping the same SQL.

Is Rails Slow? I Built the Same Blog API Eight Times to Price the Framework

"Rails is slow" is an unanswerable question, because a Rails app and a Go app are never doing the same work. So I narrowed it: inside one runtime, what do the framework and the ORM cost? Four runtimes, each built twice, all returning identical JSON from the identical four SQL statements, measured three times on Docker Linux with MySQL. The abstraction cost in CPU per request came out at ×7.67 for Ruby, ×6.14 for Python, ×2.62 for Node and ×2.51 for Go — and I counted, object by object, exactly what Active Record builds on every request.