You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by "Rainer Döbele (JIRA)" <em...@incubator.apache.org> on 2014/10/17 15:27:34 UTC

[jira] [Commented] (EMPIREDB-213) DBReader performance improvement with field caching

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

Rainer Döbele commented on EMPIREDB-213:
----------------------------------------

Hi Ivan,
thanks for your suggestion. This shows one good side of Empire-db: you can always override and improve things for your own purpose.
The question is: Do we want to make a change to the base implementation that is the default behavior?
At the moment I am not sure, whether this is necessary.
It's a tradeoff between performance and memory.
Regards
Rainer


> 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)