startup time improvements

Description

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)

Environment

None

Activity

Show:
Stefan Fleiter
January 21, 2008, 11:55 AM

What's the state of this bug?
The startup time is the major disadvantage of using hibernate (during development).
This does not only cost money, but demotivates developers which is even more costly in the end.

Duc Vu Anh
January 15, 2014, 9:46 AM

I'm using Hibernate 4.3, and still have this performance issue.
as I debug, most of time was spent in org.hibernate.cfg.Configuration#processAnnotatedClassesQueue() method.

Any one has idea to improve it?

Emmanuel Bernard
January 15, 2014, 10:15 AM

Hi Michael, this is not really surprising as processAnnotatedClassesQueue does call bindClass repeatedly which does most of the work.
There is a new approach in Hibernate ORM 5 wrt metadata binding. We hope it will bring possibilities to speed things up.

Emmanuel Bernard
January 15, 2014, 10:16 AM

Closing this issue as out of date as Max's experiments are on a very old code base.

Brett Meyer
March 7, 2014, 5:31 PM

Bulk closing rejected tickets in "resolved" state.

Out of Date

Assignee

Max Rydahl Andersen

Reporter

Max Rydahl Andersen

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure