
Creating a resource with relationships is 3 times slower on DM 1.0 v.s. DM 0.10
Reported by Alexander Sorokin | November 2nd, 2010 @ 06:04 PM | in 1.1.1
Persisting 100 instances of a resource on DM 1.0 takes 4.76 sec (with profiling on). The same operation takes 1.16 seconds on DM 0.10. Screenshots are attached. The model has around 20 properties and 4 related resources (it belongs to them).
Profiling screenshots are attached.
Comments and changes to this ticket
-
Martin Gamsjaeger (snusnu) November 4th, 2010 @ 06:01 AM
- State changed from new to unconfirmed
- Tag set to performance, regression
-
Xavier Shay December 2nd, 2010 @ 11:26 PM
As with #1442, a stand alone benchmarking script would be helpful.
-
Alexander Sorokin January 5th, 2011 @ 05:20 PM
Here's a standalone example. It's super-simple and gives almost 2x performance degradation with DM 1.0.2.
https://gist.github.com/767201
Thanks for the example template!
Can you run the benchmark and confirm my timings?
-
Xavier Shay January 9th, 2011 @ 05:21 PM
What version of dm-postgres-adapter are you using for 0.10? I can get all the other gems into a gemset using:
gem install dm-core dm-migrations dm-timestamps --version "~> 0.10" --no-rdoc --no-ri
My results for v1 showed a big difference between 1.8 and 1.9:
== 1.0.2 1.9: 1.600000 0.070000 1.670000 ( 2.202385) 1.8: 2.510000 0.110000 2.620000 ( 3.133895)
-
Alexander Sorokin January 9th, 2011 @ 09:20 PM
We're using do_postgres-0.10.0 for 0.10 and ruby 1.8.
-
Alexander Sorokin January 10th, 2011 @ 02:20 PM
Yep. Ruby 1.9 is much faster. The gap with 0.10 is still there.
== DM 0.10, ruby 1.9 0.560000 0.050000 0.610000 ( 1.470046)
-
Alexander Sorokin January 10th, 2011 @ 02:21 PM
Yep. Ruby 1.9 is much faster. The gap with 0.10 is still there.
== DM 0.10, ruby 1.9
0.560000 0.050000 0.610000 ( 1.470046)
-
Xavier Shay January 11th, 2011 @ 01:18 AM
I can't seem to find that version of the gem anywhere. Can you attach it? I'll have a play around with some profiling tonight anyways.
-
Xavier Shay January 11th, 2011 @ 02:34 AM
Saved a bit with a micro-optimization, but seems the biggest problems are structural? Would like to be wrong.
Could be a win disabling assertions in production, they account for ~20% of the time. -
Dan Kubb (dkubb) January 11th, 2011 @ 02:34 AM
(from [733895177138b8674897deb6e806de468542b1ce]) Speed up #normalize_options by ~2x
[#1443] https://github.com/datamapper/dm-core/commit/733895177138b8674897de...
-
Alexander Sorokin January 11th, 2011 @ 12:29 PM
I couldn't attach the gems here. I put them on S3: https://datamapper.s3.amazonaws.com/all_gems.tgz?AWSAccessKeyId=AKI...
-
Alexander Sorokin January 12th, 2011 @ 06:06 PM
Something has changed on my system, so that overall timings are better. There's an worrying trend however:
DM 0.10.0 | 0.960000 0.070000 1.030000 ( 1.903432)
DM 1.0.2 (gem fetch) | 2.480000 0.110000 2.590000 ( 3.622813)
DM 1.0.2 (built from master) | 3.200000 0.110000 3.310000 ( 4.326419)(normalize_options makes it faster, but there seems to be something else that takes more time)
-
Alexander Sorokin February 1st, 2011 @ 02:12 PM
Do you guys have timeline for this? Do you plan to investigate this more?
-
Xavier Shay February 1st, 2011 @ 04:25 PM
I plan to look at some general performance things such as iterating through collections, which I believe will be related to this. I don't have any time pressure though.
-
Alexander Sorokin February 1st, 2011 @ 04:56 PM
Thanks! We're blocked on these two tickets for our upgrade to DM 1.0.*. I hope that once these get resolved, we'll be able to switch over. We don't want to sit on 0.10 forever, that's why I'm checking on this :)
Thanks a lot for the hard work! It's awesome!
-
Piotr Solnica (solnic) February 2nd, 2011 @ 03:35 AM
I can also take a look and here are my results on 1.9.2p136: https://gist.github.com/807464 Seems like it's almost the same...
-
Dan Kubb (dkubb) March 16th, 2011 @ 11:07 PM
- State changed from unconfirmed to confirmed
- Milestone set to 1.1.1
- Milestone order changed from 196304 to 0
Alexander, even though we're about to release DatMapper 1.1 today I want you to know we haven't forgotten about this.
I'm going to set one of our goals for 1.1.1 (or 1.2 if it requires minor api changes) to optimize the pathways for Model#new, Model#create and Model#all.
In the meantime if you have any profiling output please feel free to attach it to this ticket. We'll be doing our own measuring, but it would be nice to have a baseline from you before we get started. (I saw the screenshots, but the full report would probably be most useful)
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Attachments
Tags
Referenced by
-
1442 ManyToOne::Relationship#get is much slower in DM 1.0.2 v.s. DM 0.10.0 Let me know, what are the next steps on this ticket. If y...
-
1442 ManyToOne::Relationship#get is much slower in DM 1.0.2 v.s. DM 0.10.0 As per #1443, I haven't got a 0.10 env yet, but saw a big...
-
1442 ManyToOne::Relationship#get is much slower in DM 1.0.2 v.s. DM 0.10.0 As in #1443
-
1443 Creating a resource with relationships is 3 times slower on DM 1.0 v.s. DM 0.10 [#1443] https://github.com/datamapper/dm-core/commit/733...