[ 
https://issues.apache.org/jira/browse/EMPIREDB-213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14175117#comment-14175117
 ] 

Ivan Nemeth commented on EMPIREDB-213:
--------------------------------------

Hi Rainer,

I don't see any significant memory problems, only a hashmap is needed which has 
Integers as the values and the columns as the keys (which are already in the 
fields array). 

If you don't want to make it default it's ok, with subclassing I can manage it. 
But maybe it can be handled with some configuration parameters 
(empire.dbreader.fieldcachingenabled) and/or some init params on the DBReader 
(setUseFieldCaching(boolean)).

Btw you are right, Empire is a very developer friendly framework with 
subclassing and extending, compared to Hibernate, which is rather a black box 
for me.

Regards,
Ivan 

> DBReader performance improvement with field caching
> ---------------------------------------------------
>
>                 Key: EMPIREDB-213
>                 URL: https://issues.apache.org/jira/browse/EMPIREDB-213
>             Project: Empire-DB
>          Issue Type: Improvement
>            Reporter: Ivan Nemeth
>
> DBReader can be much faster for resultsets with many columns if the 
> getFieldIndex(ColumnExpr c) method uses some kind of caching. The following 
> code is 10 times faster for a resultset with 20000 rows and 70 columns.
> public class MyDBReader extends DBReader {
>       private static final long serialVersionUID = 1L;
>       
>       private Map<ColumnExpr, Integer> fieldIndices = new HashMap<ColumnExpr, 
> Integer>();
>       @Override
>       public int getFieldIndex(ColumnExpr column) {
>               Integer i = fieldIndices.get(column);
>               if (i == null){
>                       i = super.getFieldIndex(column);
>                       fieldIndices.put(column, i);
>               }
>               return i;
>       }
>       
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to