473,544 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 TotalMillisecon ds 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 1783
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 SerializationIn fo 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.co m
"Joe" <jb*******@noem ail.noemail> wrote in message
news:OS******** ********@TK2MSF TNGP10.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 TotalMillisecon ds 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.c om> wrote in
message news:OW******** *******@TK2MSFT NGP11.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 SerializationIn fo 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.co m
"Joe" <jb*******@noem ail.noemail> wrote in message
news:OS******** ********@TK2MSF TNGP10.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 TotalMillisecon ds 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*******@noem ail.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.publi c.dotnet.langua ges.csharp
| NNTP-Posting-Host: 69.37.58.70.ads l.snet.net 69.37.58.70
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.langua ges.csharp:3692 98
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.c om> wrote
in
| message news:OW******** *******@TK2MSFT NGP11.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 SerializationIn fo 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.co m
| >
| >
| > "Joe" <jb*******@noem ail.noemail> wrote in message
| > news:OS******** ********@TK2MSF TNGP10.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 TotalMillisecon ds
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******** ********@TK2MSF TNGXA02.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*******@noem ail.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.publi c.dotnet.langua ges.csharp
| NNTP-Posting-Host: 69.37.58.70.ads l.snet.net 69.37.58.70
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.langua ges.csharp:3692 98
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.c om> wrote
in
| message news:OW******** *******@TK2MSFT NGP11.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 SerializationIn fo 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.co m
| >
| >
| > "Joe" <jb*******@noem ail.noemail> wrote in message
| > news:OS******** ********@TK2MSF TNGP10.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 TotalMillisecon ds
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.mic rosoft.com> wrote in message
news:UW******** ********@TK2MSF TNGXA02.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
3160
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. It seems that either I can use default serialization or implement ISerializable. Is there any way to do both (e.g. extend the default...
3
2444
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 System.Collections.Comparer has 1 members, number of members deserialized is 0. at...
2
5809
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 and continue process the stream. My app reads and writes configuration settings to a binary file upon starting and shutdown. The settings are...
4
11387
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 look at innerException it says: "Cannot serialize member 'System.ComponentModel.Component.Site' of type 'System.ComponentModel.ISite'. OK it is...
10
1503
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? Thanks! Atmapuri
5
6107
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: Value -8590321990885400808 is outside the valid range . Parameter name: ticks at System.DateTime..ctor (Int64 ticks) at...
1
11053
by: kikisan | last post by:
I am developing a windows service which utilizes the following classes: interface IPersistable; abstract class PersistableObject : IPersistable;
2
5543
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 I am trying to read from a binary archive using Boost serialization. I am new to this, and it is possible that I have not understood the usage. In...
6
9595
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 serialization The code itself generates a list of strings comprised of random numbers. No number will be repeated within a string, and no string will...
0
7431
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7370
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7617
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7779
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7714
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5920
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
1848
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.