yeap, I got upto 60% improvement with 75 entities.
Tuna Toksöz
http://tunatoksoz.com
http://twitter.com/tehlike

Typos included to enhance the readers attention!



On Thu, Feb 5, 2009 at 4:31 PM, Ayende Rahien <[email protected]> wrote:

> And that tends to be the most expensive part of the operation, IIRC.
>
>
> On Thu, Feb 5, 2009 at 3:56 PM, Tuna Toksoz <[email protected]> wrote:
>
>> Serializing configuration saves you from XML validation, at least.
>>
>> Tuna Toksöz
>> http://tunatoksoz.com
>> http://twitter.com/tehlike
>>
>> Typos included to enhance the readers attention!
>>
>>
>>
>> On Thu, Feb 5, 2009 at 3:53 PM, Fabio Maulo <[email protected]> wrote:
>>
>>> Configuration useless.Which are the classes, used in sessionFactory
>>> state, that are not serializable ?
>>>
>>> 2009/2/5 Tuna Toksoz <[email protected]>
>>>
>>> Yesterday I played with the idea of Serializing the configuration. People
>>>> complain about sessionFactory initialization takes forever and 
>>>> serialization
>>>> is an option most of the time.
>>>> I tried the idea of serializing SessionFactory which wasn't possible
>>>> since it has dependency on many nonserializable classes within NH (and
>>>> marking them as serializable is time consuming).  Instead, I tried
>>>> serializing Configuration right after the buildSessionFactory operation
>>>>
>>>>             BinaryFormatter fm = new BinaryFormatter();
>>>>             Stopwatch sw = Stopwatch.StartNew();
>>>>             FileStream fs = new FileStream("myfile.dat",
>>>> FileMode.OpenOrCreate, FileAccess.Write);
>>>>             Configuration cfg = new Configuration();
>>>>             cfg.Configure();
>>>>             cfg.AddAssembly("DomainWith75EntityClass");
>>>>             cfg.Configure();
>>>>             cfg.BuildSessionFactory();
>>>>             fm.Serialize(fs, cfg);
>>>>             sw.Stop();
>>>>             Console.WriteLine(sw.ElapsedMilliseconds);
>>>>
>>>> before BuildSessionFactory, serialization wasn't possible as
>>>> System.Xml.XmlSchema is nonserializable.
>>>>
>>>> This took 3998 ms
>>>>
>>>> and then I tried
>>>>
>>>>             BinaryFormatter fm = new BinaryFormatter();
>>>>             Stopwatch sw = Stopwatch.StartNew();
>>>>             FileStream fs = new FileStream("myfile.dat", FileMode.Open,
>>>> FileAccess.Read);
>>>>             var cfg = fm.Deserialize(fs) as Configuration;
>>>>             cfg.BuildSessionFactory();
>>>>             sw.Stop();
>>>>             Console.WriteLine(sw.ElapsedMilliseconds);
>>>>
>>>> this took 1578 ms on average.
>>>>
>>>> Should I make Configuration serializable, or do you think it is useless?
>>>>
>>>>
>>>>
>>>> Tuna Toksöz
>>>> http://tunatoksoz.com
>>>> http://twitter.com/tehlike
>>>>
>>>> Typos included to enhance the readers attention!
>>>>
>>>>
>>>
>>>
>>> --
>>> Fabio Maulo
>>>
>>
>>
>

Reply via email to