473,322 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Serialization problem continues

Joe
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
Dec 4 '05 #1
7 1765
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

Dec 4 '05 #2
Joe
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


Dec 4 '05 #3
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
| >>
| >
| >
|
|
|

Dec 5 '05 #4
Joe
Hi Steven,

I'm only using the GetObjectData to try and track down the performance
issue. I tried several different types of collection classes and non seem to
improve performance at all. I'm using VS 2003 .NET 1.1. w/SP1

There is some other issue here which I can't seem to pin point. I can
serialize similar data (same and more data points) in seconds.

Based on my testing it seems there is an issue with the data itself. The
data in the classes were read in from Excel which originated in Oracle. Any
null values are being replaces with a default value such as 0 for numerical
and " " for a string.

This still doesn't explain why all Windows server machines perform the
serialization in seconds and non server takes 20+ minutes for the exact
data.

-Joe

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:7Q****************@TK2MSFTNGXA02.phx.gbl...
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
| >>
| >
| >
|
|
|

Dec 5 '05 #5
Hi Joe,

Are the machines running the same build of your test app? Also, did you
count the time that data were obtained from the server?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 7 '05 #6
Joe
The application is identical in version on all machines.

No need to worry about the server because the data is already in the app. I
mentioned where it originated from just in case someone had a problem with a
data type.

I can deserialize the data into the application which is very fast. Now when
I try to serialize it I get the massive delay. This delay happens any time I
serilizae the data whether it's newly imported or deserialized.

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:UW****************@TK2MSFTNGXA02.phx.gbl...
Hi Joe,

Are the machines running the same build of your test app? Also, did you
count the time that data were obtained from the server?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 7 '05 #7
Hi Joe,

I don't have enough resource to reproduce this issue on my machine. In this
case, I suggest you try to contact Microsoft PSS. You can find their
contact information from the following link:

http://support.microsoft.com/default...;OfferProPhone

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 9 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Aaron Clamage | last post by:
Hi, I'm not sure that if this is the right forum, but any help would be greatly appreciated. I am porting some java serialization code to c# and I can't figure out the correct way to do it. ...
3
by: Alexander | last post by:
When i store rule on PC with .NET.SP1 i cant restore them from PC without SP1. An i get this Error: System.Runtime.Serialization.SerializationException: Possible Version mismatch. Type...
2
by: Doug Lind | last post by:
Hi all, I have seen a number of posts re: the BinaryFormatter version incompatibility but nothing on how to recover from it. In my case, I want the exception to trigger an alternate behaviour...
4
by: mijalko | last post by:
Hi, I have inherited my class from System.Drawing.Printing.PrintDocument and I wish to serialize this object using XmlSerializer. And I get exception "There was an error reflecting type ...". If I...
10
by: Atmapuri | last post by:
Hi! I would like to deserialize an object to which other unknown objects hold multiple references. Is it possible to deserialize the object without the need to destroy and recreate it? How? ...
5
by: Nikola Skoric | last post by:
I ran in Mono a program developed on .NET Framework 2.0 and it ran OK until I tried to desirialize a object. There the program died abruptly dumping this: System.ArgumentOutOfRangeException:...
1
by: kikisan | last post by:
I am developing a windows service which utilizes the following classes: interface IPersistable; abstract class PersistableObject : IPersistable;
2
by: mkvenkit.vc | last post by:
Hello, I hope this is the right place to post a question on Boost. If not, please let me know where I can post this message and I will do so. I am having a strange problem with std::string as...
6
KevinADC
by: KevinADC | last post by:
This snippet of code provides several examples of programming techniques that can be applied to most programs. using hashes to create unique results static variable recursive function...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.