Hi to all. I can add some more information about this:
The big diference between NH and EF are in the "materialize" or "hidrate" time! I don't have the solution for this, but I can add more information to try solving it... I run the jetBrains dot Trace, and what I found was the Hidrate method to conusme almost all the time. And this is where the transformation of the SQL result to POCO is made. This is where the bottleneck is. I have also tried to use a Stateless Session and the result was even worse. I'm getting 60000 rows from the DB and with Session is taking 11000 ms and with stateless is taking 29000ms I've put a post in this group, but no answer yet... Ricardo On 12 Ago, 21:01, Stefan Nobis <[email protected]> wrote: > "F.B. ten Kate" <[email protected]> writes: > > [session vs. stateless session] > > > Well wouldn't NHibernate be slow _every_ time i run this query then? > > Not necessarily. I don't know the exact overhead, but the default, > stateful session uses caching mechanisms, so maybe filling the cache > is slow. > > I would also suspect, as NHibernate tends to be lazy, that quite some > of the internal overhead of initializing everything is delayed until > you really do something. > > Another observation I made is that my project which uses NHibernate > runs about a order of magnitude slower when run from inside Visual > Studio. Directly running the compile exe without VS is much faster > (log4net with my logging config and NHibernates intensive logging is > my current best candidate for these slowdowns, but I never really > investigated this because for me it doesn't matter). > > > After all it has no problems doing so the 2nd time i click the > > button. Also afaik EF also has to create these objects. > > Does EF have a session cache (by default)? > > I'd also agree with Fabio that it's quite pointless to micro benchmark > a complex beast like a ORM with toy examples, when these tools are > usually pay off only in quite complex scenarios and applications. If > top querying performance of mass data is your primary goal, never use > any kind of ORM, neither NHibernate nor EF. > > > I'm willing to give the stateless session a try though, how would i > > implement that? > > Instead of opening a new session with factory.OpenSession() use > factory.OpenStatelessSession(). Everything else may be left > unchanged. BTW have a look at > > http://www.nhforge.org/doc/nh/en/index.html > > -- > Until the next mail..., > Stefan. > > application_pgp-signature_part > < 1KVerTransferir --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
