-
Notifications
You must be signed in to change notification settings - Fork 6
jeremyevans/simple_orm_benchmark
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Introduction ------------ simple_orm_benchmarker is a simple script to benchmark ruby ORMs. It currently supports ActiveRecord, Sequel, and Mongoid. Configuration ------------- To use this, you first need to copy db.yml.example to db.yml, and modify it accordingly. Usage ----- Then you can run the benchmarking via: ruby simple_orm_benchmark.rb -a ruby simple_orm_benchmark.rb sequel-postgresql ruby simple_orm_benchmark.rb -l 4 activerecord-mysql ruby simple_orm_benchmark.rb -l 6 -g activerecord-sqlite sequel-sqlite Options: * -a will test all configurations in the db.yml configuration file. * -l is the testing level. It's designed to be logrithmic, with a level 6 test taking about twice as long as a level 5. The default level is 5. * -g will disable garbage collection during the test, to measure the amount of garbage the test generates. You can list one or more configurations to test as arguments. The arguments should match keys in the hash parsed from the yaml file. The output of the benchmark is in CSV, with columns in the following order: configuration_name: Name of configuration level: Testing level benchmark_name: Name of benchmark user_cpu_time: Amount of user CPU time system_cpu_time: Amount of system CPU time total_cpu_time: Amount of total CPU time elapsed_real_time: Amount of actual/real/wallclock time kb_of_memory_used: Difference in process memory usage from the benchmark transaction_used: Whether a transaction was used Most tests are run both inside of and outside of a transaction, so you get results both ways. There are also some JSON tests, which are run on databases that support JSON functions. Note that SQLite doesn't enable JSON functions by default, you have to compile the json1 extension into SQLite and make sure your ruby sqlite3 library correctly uses that version of SQLite. Alternatively, you can use the amalgalite adapter when testing on Sequel, because recent versions enable the json1 extension. Reporting --------- For easier comparison of different configurations, you can use the results_aggregator.rb script: ruby simple_orm_benchmark.rb sequel-sqlite activerecord-sqlite > r.txt ruby results_aggregator.rb r.txt That will output CSV, with columns in the following order: activerecord-sqlite_real_time sequel-sqlite_real_time benchmark_name_with_transaction Using this you can see comparitive results easily, not just for different ORMs, but also for different databases with the same ORM. Source ------ git://github.com/jeremyevans/simple_orm_benchmark.git http://github.com/jeremyevans/simple_orm_benchmark Author ------ Jeremy Evans (code@jeremyevans.net) Contact me if you have questions about this benchmark script. Contributions of new benchmark tests are appreciated. Thanks to tim.linquist@gmail.com (timo3377) for sequel-benchmark and activerecord-benchmark, on which simple_orm_benchmark is based.
About
A small benchmark test for ruby ORMs.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published