On Tuesday, December 12, 2017 at 9:26:00 AM UTC-8, Hiren Mistry wrote: > > Hi Jeremy, > > I ran some benchmarks recently to evaluate Sequel vs AR. Everything was in > favor of Sequel except for one query which makes me think maybe something > is wrong. I thought I'd bring it to your attention in case there may be a > possible regression for that query. Or maybe I didn't implement it > correctly. >
It's hard to determine why Sequel performs worse as you did not provide the full code you used for the benchmark. If you post the code you used for the benchmark, I'll look into why Sequel performs the way it does. The benchmark does show that Sequel creates a lot more garbage but retains significantly less, so if I had to guess it is related to that. My guess is there is a very small number of objects returned by the query, so the performance difference is due to the query building, not the retrieval. Sequel's support for where(association_name: model_obj) is quite involved in terms of code compared to ActiveRecord, mostly because of the much wider support in Sequel compared to ActiveRecord when using associations in queries. Sequel supports all association types, considers most association options such as conditions, supports composite keys, etc.. ActiveRecord I believe just does a simple conversion of the association name to foreign key name and model instance to primary key value. You could see if the performance is significantly different with where(topic_id: topic.id). All of this is mostly a guess on my part until I can see the code used. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
