I search the web and I cannot find a benchmark comparing grails criteria, findAll and findAllBy
So what is the fastest ?
// groovy enhance collection method
parent.childs.findAll{ it.someProperty == someValue }
or
Child.findAllByParentAndSomeProperty(parent, someValue)
or
Child.createCriteria().list{
eq('parent', parent)
eq('someProperty ', someValue)
}
UPDATE
As parent.childs.findAll is a groovy enhanced collection method, it dosen't call the database. Like:
[1,2,3,4,5].findAll{ it > 3} == [4, 5]
So am I better to call de DB or to loop through an already loaded collection.