db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oliver.m...@ppi.de
Subject minor performance improvement in CollectionProxy
Date Tue, 17 Jun 2003 10:41:23 GMT
Hello,

I would like to propose to replace the follwing 
lines 138-142 in CollectionProxy

	Collection result = (Collection) getCollectionClass().newInstance();
	if (!isEmpty())
	{
		result =
(Collection)getBroker().getCollectionByQuery(getCollectionClass(),getQuery()
);
	}

by 
	Collection result;
      if (m_size != 0)
      {
        result =
(Collection)getBroker().getCollectionByQuery(getCollectionClass(),getQuery()
);
      }
      else
      {
        result = (Collection) getCollectionClass().newInstance();
      }

If the collection size has not been loaded before,
(i.e., when m_size = -1), this saves 
the instantiation/garbarge collection of an empty collection and one
jdbc call for the collection size (inside isEmpty()).

What do you think?

Olli

Mime
View raw message