Wednesday, April 6, 2011

Are there ways to improve NHibernate's performance regarding entity instantiation?

Hi folks,

while profiling NHibernate with NHProf I noticed that a lot of time is spend for entity building or at least spend outside the query duration (database roundtrip). The project I'm currently working on prefetches some static data (which goes into the 2nd level cache) at application start. There are about 3000 rows in the result set (and maybe 30 columns) that is queried in 75 ms. The overall duration observed by NHProf is about 13 SECONDS! Is this typical beheviour? I know that NHibernate shouldn't be used for bulk operations, but I didn't thought that entity instantiation would be so expensive.

Are there ways to improve performance in such situations or do I have to live with it?

Thx, denny_ch

From stackoverflow
  • I've not done this but I think you may ned to imlement your own entity creation interceptor. There are some specs here.

    By providing your own implementation you can decide on the allocation and disposal strategy and thus optimise your performance in the entity creation.

    denny_ch : How will an additional interceptor help on improving performance?
    mxmissile : implementation != additional

0 comments:

Post a Comment