empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Döbele (JIRA) <empire-db-...@incubator.apache.org>
Subject [jira] [Updated] (EMPIREDB-213) DBReader performance improvement with field caching
Date Thu, 10 Nov 2016 16:17:58 GMT

     [ https://issues.apache.org/jira/browse/EMPIREDB-213?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rainer Döbele updated EMPIREDB-213:
-----------------------------------
    Fix Version/s:     (was: empire-db-2.4.5)
                   empire-db-2.4.1

> 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
>            Assignee: Rainer Döbele
>             Fix For: empire-db-2.4.5
>
>
> 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)

Mime
View raw message