Forgot about the profiler question, When i say duration i'm looking at the SQL:BatchCompleted row, which with my limited SQL Profiler knowledge shows the time it took the SQL to execute in the "Duration" field.
On 12 aug, 14:29, "F.B. ten Kate" <[email protected]> wrote: > I'm not running a specific test, i'm simply "implementing" in a quick > dummy project, like i said this is to get used with NHibernate some > and things. I can show you the two mappings that i have though. > > <?xml version="1.0" encoding="utf-8" ?> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > assembly="NHibernate2" namespace="NHibernate2"> > <class name="Debiteur" table="tbl_Debiteur" > > <id name="Id" column="Debiteur_ID" type="Int32"> > <generator class="increment" /> > </id> > <property name="Name" column="Debiteurnaam" /> > <many-to-one name="Entiteit" lazy="no-proxy" > column="Entiteit_ID"/> > <property column="Sorteernaam" type="String" > name="Sorteernaam" not- > null="true" length="80" /> > <property column="DatumWijziging" type="DateTime" > name="DatumWijziging" not-null="true" /> > <property column="Actief_NeeJa" type="Int32" > name="ActiefNeeJa" not- > null="true" /> > </class> > </hibernate-mapping> > > <?xml version="1.0" encoding="utf-8" ?> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > assembly="NHibernate2" namespace="NHibernate2"> > <class name="tEntiteit" table="tbl_Entiteit" > > <id name="Id" column="Entiteit_ID" type="Int32"> > <generator class="increment" /> > </id> > <property name="Name" column="Bedrijfsnaam" /> > <bag name ="Debiteurs" lazy="true"> > <key column ="Entiteit_ID"> > </key> > <one-to-many class="Debiteur"/> > </bag> > </class> > </hibernate-mapping> > > Here is my NHibernate config. > > <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" > > <session-factory> > <property > name="connection.driver_class">NHibernate.Driver.SqlClientDriver</ > property> > <property name="connection.connection_string"> > Server=server02;initial catalog=Directpay_Develop;User > Id=XXXXXXXXXXX;Password=XXXXXXXXXXXXXX > </property> > <property name="show_sql">True</property> > <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</ > property> > <property > name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, > NHibernate.ByteCode.LinFu</property> > </session-factory> > </hibernate-configuration> > On 12 aug, 14:24, Sidar Ok <[email protected]> wrote: > > > Would you mind > > > 1 - Sharing the smallest bit that reflects the problem as a whole ( your > > code under test, your tests, and mappings) > > 2 - Running a code profiler and share the screenshot of it (to pinpoint the > > bottleneck)? > > > And a question, when you are talking about the times in sql profiler, do you > > mean it is the time *just* the query takes to execute ? > > > On Wed, Aug 12, 2009 at 2:15 PM, F.B. ten Kate <[email protected]> wrote: > > > > Ow, little extra info, it's 390000 Records i'm querying, which > > > obviously is kinda alot. > > > > On 12 aug, 14:12, "F.B. ten Kate" <[email protected]> wrote: > > > > Like i said, the "timer" is in SQL Profiler. In otherwords not in the > > > > code, but i also have the following bits in there to compare. > > > > > DateTime start = DateTime.Now; > > > > IList<Debiteur> lijst = session.CreateCriteria(typeof > > > > (Debiteur)).List<Debiteur>(); > > > > DateTime stop = DateTime.Now; > > > > dataGridView1.DataSource = lijst; > > > > > MessageBox.Show((stop-start).Seconds +"."+ (stop- > > > > start).Milliseconds); > > > > > Meaning i start the timer AFTER the session has been created, and > > > > start the "query" if i am getting this. the NHibernate project atm > > > > takes 26 seconds to do this (this is with another enitity added with > > > > Lazyloading, without this entitity it was +- 21 seconds) EF does the > > > > same action in +- 5 seconds. Which leads me to believe the problem > > > > lies in the execution of the SQL. > > > > > On 12 aug, 14:07, Paco Wensveen <[email protected]> wrote: > > > > > > The sql is not executing slowly, the building of the sessionfactory is > > > > > slow. Start your timer after buildsessionfactory and compare again. > > > > > > On Wed, Aug 12, 2009 at 2:01 PM, F.B. ten Kate<[email protected]> > > > wrote: > > > > > > > Yes i am atm, since it's just a quit check to run a query, but would > > > > > > this explain the SQL executing this slowly? > > > > > > > I know i'm not using any "best" practises and things, this is the > > > > > > first thing im doing with both NHibernate and EF. > > > > > > > Here is the code running it. > > > > > > > Configuration cfg = new Configuration(); > > > > > > cfg.Configure(); > > > > > > cfg.AddAssembly(typeof(Debiteur).Assembly); > > > > > > > ISessionFactory factory = cfg.BuildSessionFactory(); > > > > > > ISession session = factory.OpenSession(); > > > > > > > IList<Debiteur> lijst = session.CreateCriteria(typeof > > > > > > (Debiteur)).List<Debiteur>(); > > > > > > > dataGridView1.DataSource = lijst; > > > > > > > On 12 aug, 13:22, Kim Johansson <[email protected]> wrote: > > > > > >> Are you creating a new SessionFactory each run? (SLOOOOOOOOOOOW!!!) > > > > > > >> You should use a single instance SessionFactory and just create new > > > > > >> sessions. > > > > > > >> F.B. ten Kate wrote: > > > > > >> > Hello there, im currently looking at some differences between > > > > > >> > both > > > > > >> > ORM's and to get a good feel for both i try to query from one > > > table > > > > > >> > and simply drop all the data in a DataGridView. > > > > > > >> > Easy as pie right? > > > > > > >> > Now here is the different SQL's beeing generated > > > > > > >> > NHibernate: > > > > > > >> > "SELECT this_.Debiteur_ID as Debiteur1_0_0_, this_.Debiteurnaam > > > > > >> > as > > > > > >> > Debiteur2_0_0_, this_.Entiteit_ID as Entiteit3_0_0_, > > > this_.Sorteernaam > > > > > >> > as Sorteern4_0_0_, this_.DatumWijziging as > > > > > >> > DatumWij5_0_0_, this_.Actief_NeeJa as Actief6_0_0_ FROM > > > tbl_Debiteur > > > > > >> > this_" > > > > > > >> > Enitity Framework: > > > > > > >> > "SELECT > > > > > >> > [Extent1].[Actief_NeeJa] AS [Actief_NeeJa], > > > > > >> > [Extent1].[DatumWijziging] AS [DatumWijziging], > > > > > >> > [Extent1].[Debiteur_ID] AS [Debiteur_ID], > > > > > >> > [Extent1].[Debiteurnaam] AS [Debiteurnaam], > > > > > >> > [Extent1].[Entiteit_ID] AS [Entiteit_ID], > > > > > >> > [Extent1].[Sorteernaam] AS [Sorteernaam] > > > > > >> > FROM [dbo].[tbl_Debiteur] AS [Extent1]" > > > > > > >> > Okay, so sofar EF wins in readability atleast but i dont intend > > > > > >> > to > > > > > >> > actually look at the queries so i'm not worried. > > > > > > >> > I noticed that NHibernate was ALOT slower then EF, the reasons > > > seemed > > > > > >> > like a mistery to me so i ran SQL Profiler. > > > > > > >> > When i run the NHibernate project the query runs for a duration > > > > > >> > of > > > > > >> > 19369 (milliseconds) > > > > > > >> > Then i run Enitity frame work which runs for a duration of 3621 > > > > > >> > (milliseconds) > > > > > > >> > (I clear caches between the different queries) > > > > > > >> > I then run the query in SQL Management Studio, The NHibernate has > > > a > > > > > >> > duration of 4291 (milliseconds) > > > > > >> > I do the same for the Enitity framework which has a duration of > > > 4291 > > > > > >> > (milliseconds) > > > > > > >> > Can anyone explain to me these durations? mostly the NHibernate > > > time > > > > > >> > when running it from application code is HUGE. Eventhough the SQL > > > is > > > > > >> > exactly the same... > > > -- > > Sidar Ok > > >http://www.sidarok.comhttp://www.twitter.com/sidarok --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
