We are using an interactor that lists models. It accepts a Mongoid::Criteria as input and a filter that is used to limit the scope of the criteria further. Occasionally, this interactor would run very slowly, and we found that in the matches? method in object_filter.rb, the value is compared against nil. This means that if the value is a potentially expensive Mongoid::Criteria object, performance could be impacted as the criteria must be resolved to perform the comparison.
This may have already been considered, but would it be possible to use .nil? for comparision instead? This would leave the criteria unresolved.
We are using an interactor that lists models. It accepts a
Mongoid::Criteriaas input and a filter that is used to limit the scope of the criteria further. Occasionally, this interactor would run very slowly, and we found that in thematches?method inobject_filter.rb, the value is compared againstnil. This means that if the value is a potentially expensiveMongoid::Criteriaobject, performance could be impacted as the criteria must be resolved to perform the comparison.This may have already been considered, but would it be possible to use
.nil?for comparision instead? This would leave the criteria unresolved.