I often get asked about whether Sequel performs better than
ActiveRecord, and until now I've said that I haven't done any real
testing, but I thought they performed similarly.  I've already posted
that Sequel is significantly faster to startup and uses less memory at
startup than ActiveRecord (http://groups.google.com/group/sequel-talk/
browse_thread/thread/43335dc05ad33085/2e6a8180a04aa44e), but I hadn't
done any serious performance benchmarking, until now.

I had some time, so I've improved my simple_orm_benchmarker tool
(http://github.com/jeremyevans/simple_orm_benchmark), to be able to
give comparative results between different ORMs and databases.

I'm pretty pleased with the results, and they show some interesting
differences between the ORMs.  The raw data for this post can be found
at http://pastie.org/484334.txt.

Here's my summary of the results:

* ActiveRecord is generally faster on MySQL than PostgreSQL
* Sequel is generally faster on PostgreSQL than MySQL
* Eager loading is generally fastest using Sequel with PostgreSQL.
* Eager loading with a query per association  (the default in both
Sequel and ActiveRecord) is always faster using Sequel:
  * MySQL: 50% faster
  * SQLite: 70% faster
  * PostgreSQL: 170% faster
* Eager loading with a single query (Sequel's eager_graph), it
depends:
  * 1-1 correspondence (1 record in the associated table for each
record in current table): Sequel 30-150% faster
  * 1-32 correspondence (32 records in the associated table for each
record in current table): Even-Sequel 50% faster
  * 1-32-32 correspondence (joining 2 associated tables, 32x32=1024
rows for each record in current table):
    * MySQL: ActiveRecord 30% faster
    * PostgreSQL: Even,
    * SQLite: Sequel 7% faster
* Lazy loading associations depends:
  * 1-1 correspondence: ActiveRecord 12-26% faster
  * 1-32 correspondence: Even-Sequel 32% faster
* Model object creation: ActiveRecord 33% faster-Sequel 50% faster
* Model object destruction: ActiveRecord 45% faster-Sequel 62% faster
* Model object retrieval:
  * MySQL: Active Record 44% faster
  * PostgreSQL: Sequel 90% faster
  * SQLite: Sequel 11% faster
* Model object retrieve and update: Sequel 50-125% faster

I'd love to see more benchmarks contributed to
simple_orm_benchmarker.  Just send me a patch or pull request.  If you
have any questions that can't be answered by looking at the
simple_orm_benchmarker code, please ask here.

Thanks,
Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to