You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by td...@freenet.de on 2007/07/02 15:40:53 UTC

Example Performance best practise

After finding the *Examples-Criteria a very nice feature,  but thinking now about performance:

List find(String likename)
{
          EmployeeExample example = new EmployeeExample();
          example.createCriteria()
            .andNameLike( likename );
        
          ...and maybe more criterias
          ....
}


Question I think about:
Is that a approbiate way  if this gets always constructed new especially if often called. 
Couldnt that not be done better or should I then use better a manual SQLMap config instead ?  
(Maybe it is the same as with a PreparedStatement  setting the "?"-Parameters,  
 but think that a preparedStatement or whatever is a step afterwards constructing the criteria, 
so question remains)

This can maybe also be seen as a general question,  how performance is best practised with iBatis.
I think generation of new objects should be kept as minimal as possible.
(Is there a benchmark  compared to jdbc, hibernate,...  available)








Re: Example Performance best practise

Posted by Larry Meadors <lm...@apache.org>.
My advice here is this: If it's not a problem, don't try to optimize
it. If it is, do.

In 99.99% of cases your bigger optimization will be in the SQL
queries, not object creation (especially in this case).

There are a couple of free Java profilers, and some exceptionally nice
commercial ones. Build your application reasonably efficiently (i.e.,
don't do crazy stuff like many nested loops), then look for
bottlenecks, not the other way around.

Larry


On 7/2/07, tdev@freenet.de <td...@freenet.de> wrote:
> After finding the *Examples-Criteria a very nice feature,  but thinking now about performance:
>
> List find(String likename)
> {
>           EmployeeExample example = new EmployeeExample();
>           example.createCriteria()
>             .andNameLike( likename );
>
>           ...and maybe more criterias
>           ....
> }
>
>
> Question I think about:
> Is that a approbiate way  if this gets always constructed new especially if often called.
> Couldnt that not be done better or should I then use better a manual SQLMap config instead ?
> (Maybe it is the same as with a PreparedStatement  setting the "?"-Parameters,
>  but think that a preparedStatement or whatever is a step afterwards constructing the criteria,
> so question remains)
>
> This can maybe also be seen as a general question,  how performance is best practised with iBatis.
> I think generation of new objects should be kept as minimal as possible.
> (Is there a benchmark  compared to jdbc, hibernate,...  available)
>
>
>
>
>
>
>
>