Click here to Skip to main content
15,880,891 members
Home / Discussions / C#
   

C#

 
GeneralRe: #if indentation [modified] Pin
#realJSOP30-Jan-10 8:33
mve#realJSOP30-Jan-10 8:33 
GeneralRe: #if indentation Pin
Not Active30-Jan-10 13:18
mentorNot Active30-Jan-10 13:18 
Questionbuilding a safe environemnt to run suspicious EXEs Pin
Mohamed hossam29-Jan-10 7:02
Mohamed hossam29-Jan-10 7:02 
AnswerRe: building a safe environemnt to run suspicious EXEs Pin
EliottA29-Jan-10 7:48
EliottA29-Jan-10 7:48 
GeneralRe: building a safe environemnt to run suspicious EXEs [modified] Pin
Mohamed hossam29-Jan-10 9:16
Mohamed hossam29-Jan-10 9:16 
AnswerRe: building a safe environemnt to run suspicious EXEs Pin
Ravi Bhavnani29-Jan-10 8:46
professionalRavi Bhavnani29-Jan-10 8:46 
GeneralRe: building a safe environemnt to run suspicious EXEs Pin
Mohamed hossam29-Jan-10 9:41
Mohamed hossam29-Jan-10 9:41 
QuestionDeserializing Generic List<object> taking a lot of time</object> Pin
abhinish29-Jan-10 4:34
abhinish29-Jan-10 4:34 
Hello Guys,

Need some help from you guys.

I have Generic List having a Class object.
I have added around 3000000 items in the list

List <CTempClass> lsTemp = new List <CTempClass> ();

when i tried to Serialize the with binary formater it is working fine

but when I deserialize the List it takes a lot of time around 30 Seconds.

But when i fill the Generic List with any datatype like

List<ulong> lsTemp = new List<ulong>();

and follow the same procedure the speed difference is drastic the while thing deserializes in 1 -2 Seconds

My Class object is Declared Serializable.

I dont understand why it is serialzer is behaving like this.

Am i Missing something.

Here is the Sample Code :

List<CTempClass> lsTemp = new List<CTempClass>();<br />
<br />
  for(int i=0; i < 5000000;i++)<br />
  {<br />
    CTempClass oTemp = new CTempClass();<br />
    oTemp.ID = i;<br />
    lsTemp.Add(oTemp);<br />
    oTemp=null;<br />
  }<br />
<br />
             using (Stream stream = File.Open("c:\\data.bin", FileMode.CreateNew))<br />
              {<br />
                  BinaryFormatter bin = new BinaryFormatter();<br />
                  bin.Serialize(stream, lsTemp );<br />
                        <br />
              }<br />
<br />
//this takes a lot of time<br />
            using (Stream stream = File.Open("c:\\data.bin", FileMode.Open))<br />
             {<br />
                 BinaryFormatter bin = new BinaryFormatter();<br />
                 var lsTemp1 = bin.Deserialize(stream);<br />
<br />
             }


here is the code of temp class
[Serializable]<br />
    public class CTempClass : ISerializable  <br />
    {<br />
      //  public int nId;      <br />
       <br />
        <br />
        private ulong m_uCrc64;        <br />
        <br />
        public CTempClass ()<br />
        {<br />
            m_uCrc64 = 0;            <br />
        }<br />
<br />
        //Deserialization constructor.<br />
        public CTempClass (SerializationInfo info, StreamingContext ctxt)<br />
        {<br />
            //Get the values from info and assign them to the appropriate properties<br />
            m_uCrc64 = info.GetUInt64("m_uCrc64");<br />
<br />
        }<br />
<br />
        //Serialization function.<br />
        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)<br />
        {<br />
           <br />
            info.AddValue("m_uCrc64", m_uCrc64);<br />
            <br />
        }<br />
<br />
    }


Can any one please tell me why it is taking so much of time.
Any suggestion will be a great help

abhinav

AnswerRe: Deserializing Generic List taking a lot of time Pin
Not Active29-Jan-10 6:19
mentorNot Active29-Jan-10 6:19 
GeneralRe: Deserializing Generic List taking a lot of time Pin
J4amieC29-Jan-10 6:34
J4amieC29-Jan-10 6:34 
AnswerRe: Deserializing Generic List taking a lot of time Pin
Ilia Blank29-Jan-10 6:52
Ilia Blank29-Jan-10 6:52 
GeneralRe: Deserializing Generic List taking a lot of time Pin
abhinish29-Jan-10 16:49
abhinish29-Jan-10 16:49 
GeneralRe: Deserializing Generic List taking a lot of time [modified] Pin
Ilia Blank1-Feb-10 4:54
Ilia Blank1-Feb-10 4:54 
Questionhow to reduce space in between two lines in word Pin
ravindra chintha29-Jan-10 1:35
ravindra chintha29-Jan-10 1:35 
AnswerRe: how to reduce space in between two lines in word Pin
Eddy Vluggen29-Jan-10 1:53
professionalEddy Vluggen29-Jan-10 1:53 
GeneralRe: how to reduce space in between two lines in word Pin
ravindra chintha29-Jan-10 1:57
ravindra chintha29-Jan-10 1:57 
GeneralRe: how to reduce space in between two lines in word Pin
ravindra chintha29-Jan-10 2:04
ravindra chintha29-Jan-10 2:04 
GeneralRe: how to reduce space in between two lines in word [modified] Pin
Eddy Vluggen29-Jan-10 2:20
professionalEddy Vluggen29-Jan-10 2:20 
QuestionSpeech Recognition Pin
krinaljariwala29-Jan-10 1:28
krinaljariwala29-Jan-10 1:28 
AnswerRe: Speech Recognition Pin
Migounette29-Jan-10 8:30
Migounette29-Jan-10 8:30 
GeneralRe: Speech Recognition Pin
krinaljariwala1-Feb-10 4:14
krinaljariwala1-Feb-10 4:14 
GeneralRe: Speech Recognition Pin
Migounette4-Feb-10 6:28
Migounette4-Feb-10 6:28 
QuestionGDI Region blending Pin
VCsamir29-Jan-10 0:54
VCsamir29-Jan-10 0:54 
QuestionSystem.Runtime.InteropServices.COMException Pin
Sunil G28-Jan-10 23:45
Sunil G28-Jan-10 23:45 
AnswerRe: System.Runtime.InteropServices.COMException Pin
OriginalGriff29-Jan-10 0:15
mveOriginalGriff29-Jan-10 0:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.