-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
Hello
I'm having trouble with new version of mongoid. So far I've been running version 3.1.6, after upgrading to 4.0.0 I noticed drastically performance reduction.
Please take a look at this very simple benchmark:
ruby require "mongoid" require "benchmark" Mongoid.connect_to("benchmark") Mongoid.purge! class TestDoc include Mongoid::Document field :field_name_1 field :field_name_2 field :field_name_3 end Benchmark.bm do |x| x.report("insert") do 100_000.times { |i| TestDoc.create(field_name_1: i, field_name_2: "field name 2", field_name_3: "field name 3") } end end
This thing runs on mongoid 4.0.0 over 3 times slower when compared to 3.1.6 - my question is this code somehow flawed (am I missing something obvious here?) or should I go :dancer: with ruby-prof and look for a cause? I tried mongoid 4.0.0 rc1 and rc2 - the results are even worse.
Ruby / mongodb / cpu / os:
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
mongod 2.6.3
Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz
Linux 3.11.0-15-generic MONGOID-26-Ubuntu SMP x86_64 GNU/Linux
Any insight is greatly appreciated, cheers :wink: