These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Performance
PostPosted: Fri Jul 07, 2006 9:49 am 
Newbie

Joined: Fri Jul 07, 2006 9:26 am
Posts: 5
hi, all.
Have you ever profiled nHiber with some load tests? I did it and found something interesting. Test is to load 200k objects from DB. Here are two moments:
1) Almost 10% of all the time was spent to do the following:
Code:
object AbstractEntityPersister.get_IdentifierSpace()
{ return this.entityMetamodel.RootType.AssemblyQualifiedName; }

I've replaced this with following:
Code:
object AbstractEntityPersister.get_IdentifierSpace()
{ return this.entityMetamodel.RootTypeAssemblyQualifiedName; }
...

//in class EntityMetamodel:

string rootTypeAssemblyQualifiedName;
string RootTypeAssemblyQualifiedName
{ get {return rootTypeAssemblyQualifiedName;} }
public EntityMetamodel(...)
{
  ...
  rootTypeAssemblyQualifiedName = rootType.AssemblyQualifiedName;
  ...
}


2) After that 38% (!!!) of all the time was spent to perform AbstractEntityPersister.SetIdentifier(...) because of using reflection to set simple int-typed identity field. It wasn't done with LCG.

I'm working on it now. Will you use consider my modifications? Shall I post it here?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 07, 2006 10:13 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
This is interesting. Can you submit a JIRA issue with your proposed patch? Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 2:34 am 
Newbie

Joined: Sat Apr 01, 2006 1:23 am
Posts: 14
nayato

I'm curious, how much overhead did NHibernate add compared to just using ado.net to do the load? Similarly if you did a select query in nhiberante to just retrieve the properties without objects, how different was that?

Neil


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 3:33 am 
Newbie

Joined: Fri Jul 07, 2006 9:26 am
Posts: 5
nacarson wrote:
I'm curious, how much overhead did NHibernate add compared to just using ado.net to do the load? Similarly if you did a select query in nhiberante to just retrieve the properties without objects, how different was that?

Well, SqlReader did work (read 200,000 rows five times and fill objects (direct instantiation)) by 3,2 seconds while nHiber did the same by 52 seconds.

Quote:
This is interesting. Can you submit a JIRA issue with your proposed patch? Thanks.

Sergey, the root of the evil in my test was that ID was mapped with nosetter accessor (to prevent direct assignment) so nHiber was using FieldSetter.Set which assign private field by reflection. I solved this issue and did some tests.
Can I send it to you by e-mail? JIRA seems to be a little buggy for me (always says that page is not found)...

BTW, now nHiber do this work by 27 seconds ;) 48% faster...

I'll check if other routines can also be optimised.[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 4:52 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Ok, send it by e-mail. By the way, which profiler do you use?


Top
 Profile  
 
 Post subject: Profiler
PostPosted: Mon Jul 10, 2006 5:23 am 
Newbie

Joined: Fri Jul 07, 2006 9:26 am
Posts: 5
sergey wrote:
Ok, send it by e-mail. By the way, which profiler do you use?

I'm using VS2005 built-in profiler. It seems to be ok 'cause actual time-tests say the same after optimization :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.