Hi Joe,
I think you can try avoid so much time of string concatenate operation like:
("item" + i.ToString(),
in the serizliation code since such operation will consume much memorty and
will hit peformance also....
as for basic types, boxing, unboxing is also time consuming, are you using
.net framework 1.1 or 2.0? Maybe the generic collection in 2.0 will be more
suitable for such collection...
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Joe" <jb*******@noemail.noemail>
| References: <OS**************@TK2MSFTNGP10.phx.gbl>
<OW*************@TK2MSFTNGP11.phx.gbl>
| Subject: Re: Serialization problem continues
| Date: Sun, 4 Dec 2005 13:13:51 -0500
| Lines: 80
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| X-RFC2646: Format=Flowed; Response
| Message-ID: <e4**************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: 69.37.58.70.adsl.snet.net 69.37.58.70
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.languages.csharp:369298
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hi Nicholas,
|
| It takes any where from 65-98 seconds to write this. There are 30 of
these
| that need to be written. The strangest part about this is that the entire
| process on a Windows 2003 server takes about 1.5 - 2.5 seconds but on XP
Pro
| or Win 2k pro it takes much, much longer like up to 30+ minutes.
|
| The machine I'm testing on now has dual Xeon 3.0 GHz with 2gig ram. One
of
| the servers (where it take 2 seconds) if a 1.7 GHz with 1gig ram.
|
| I've done other testing where I create another class inherit from
| CollectionBase, add 100,000 values to it and serialize it and it's done
in
| ~1.5 seconds. For the most part it's the same class just with bogus data.
|
| -Joe
|
| "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in
| message news:OW***************@TK2MSFTNGP11.phx.gbl...
| > Joe,
| >
| > What is the total time you are seeing when it comes to serializing
| > these objects? 60000 objects is going to take some time, no matter how
| > you cut it (even if they are small). Chances are that you don't need
to
| > implement custom serialization in this case either.
| >
| > You might get some speed increase by creating a byte array to store
the
| > information, and serializing the information yourself. However, this
| > would require you to keep in mind the type information, and as well as
the
| > order that you are serializing the information in. This would allow
you
| > to not have to store the type information for each item that is being
| > serialized.
| >
| > However, this might not be enough. The SerializationInfo instance
| > stores the information in a hashtable, and that hashtable expands as
you
| > add items to it, copying the elements over when more memory is needed.
| >
| > Anyways, 60000 is a large amount of objects, and you are going to
have
| > to pay a price somewhere along the line for that.
| >
| >
| > --
| > - Nicholas Paldino [.NET/C# MVP]
| > -
mv*@spam.guard.caspershouse.com
| >
| >
| > "Joe" <jb*******@noemail.noemail> wrote in message
| > news:OS****************@TK2MSFTNGP10.phx.gbl...
| >> I've tracked the performance issue down to a single class. This class
| >> derives from CollectionBase and stores a basic value type such as
string,
| >> int, double, etc... I also store the type itself which you can see I'm
| >> using when calling AddValue.
| >>
| >> I implemented ISerializable and GeteObjectData.
| >> Here's what I tried:
| >>
| >> for (int i = 0; i < this.Count; i++)
| >> info.AddValue("item" + i.ToString(), this[i], typeof(type) );
| >>
| >> Count = ~60,000
| >>
| >> I added some logging to see how long it takes and get some interesting
| >> results but can't find the problem.
| >> Using basic DateTime for start and end I check the TotalMilliseconds
for
| >> each call to AddValue and most show as 0 but ~6000 show as taking
15.625
| >> milliseconds. The first one shows around the 15,000 item although it
is
| >> not always the same. I also write the value out to a log file and they
| >> all seem fine.
| >> I have a try catch but nothing seems to get thrown although I do get a
| >> flash of my application which is typical when an exception has
occurred.
| >>
| >> Is there any further way of debugging this?
| >>
| >> I'm desperate for help.
| >> Thanks,
| >> Joe
| >>
| >
| >
|
|
|