[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1258) startup time improvements
Tyler Van Gorder (JIRA)
noreply at atlassian.com
Wed Oct 11 14:21:25 EDT 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1258?page=comments#action_24775 ]
Tyler Van Gorder commented on HHH-1258:
---------------------------------------
Hi Max,
I got some time at a recent conference to work on a 3.2 version of the "on-demand" configuration loading. A couple of comments:
- This patch is intended to ONLY be used in a testing environment
- This patch is strictly to the SessionFactoryImpl
- This patch is not yet thread-safe.
What I have done:
- The sessionfactory implementation keeps a reference to both the configuration and mapping objects.
- There is a boolean "onDemandConfiguration" to turn this "patch" on/off.
- The maps : entityPersisters, classMetadata, collectionPersisters, collectionMetadata have been made mutable.
- Initialization (when the patch is on) still populates the maps however, the maps contain PersistentClass (for entityPersisters)
and Collection (for collectionPersisters)
- Any place where either the entityPersisters or collectionPersisters map is accessed, I check the type, if its a PersistentClass
then I create the entityPersister at that point and replace the entry in the map. ditto for Collection.
My only concern is the following method: "getImplementors"
- I am not sure I am doing everything correct in here when the entry is a PersistentClass rather than an EntityPersister.
Finally, thread safety:
This should be totally doable, I don't think I can add a monitor to each map, because they may be accessed in different orders and result in a deadlock, which means there needs to be one monitor for all the mutable maps. What are your thoughts on this?
Thanks.
Tyler.
See attatched file:
> startup time improvements
> -------------------------
>
> Key: HHH-1258
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1258
> Project: Hibernate3
> Type: Improvement
> Components: core
> Versions: 3.1 rc3
> Reporter: Max Rydahl Andersen
> Assignee: Max Rydahl Andersen
>
>
> while doing some basic startup perf testing the following were found - this issue is mainly to track what I find, and then fix it:
> Initial tests where 100 classes, 30 sec for buildSessionFactory
> setting hibernate.cglib.use_reflection_optimizer false and it is 10 sec for buildSessionFactory.
> (maybe we should autodetect which jdk we are running on and disable it per default for 1.4/1.5 - needs to validate runtime impact)
> Another (22%) time stealer is the discovery of getter/setters - in worst case it iterates over all declared methods per property.
> (alternatively we could cache/sort this list or make a more efficient implementation if a class only contain default property accessors)
> Other 20% of the time is done in net.sf.cglib related classes for build time enhancement.
> The rest of the time is Configuration creation (can be cached) and other iteration code.
> (p.s. don't take the % numbers as hard values - these are definitly affected by how many methods/classes you have; this underlying tests
> is done on pojos with a "high" method count (approx 100)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list