I've got an ArrayList of objects that I'd like to save/retrieve as quickly
as possible. Each item in the arraylist is an object with about 50
variable-length strings; many zero-length, some about 80 chars or so,
if that matters.
I figured I'd set the [Serializable] attribute on the object and on the
ArrayList and use standard Serialize() functions. This is just incredibly
slow. Is that normal? Any other recommended approach?
The function itself is listed below, but I think it's boilerplate:
private bool Serialize(string Filename) {
FileStream binfs;
IFormatter ifmtr = new BinaryFormatter();
bool retval = true;
binfs = new FileStream(
Filename, // expect full path and file name
FileMode.Create,
FileAccess.Write,
FileShare.None);
try {
ifmtr.Serialize(binfs, this);
binfs.Close();
} catch (SerializationException ex) {
// MessageBox.Show(ex.ToString());
retval = false;
}
return retval;
} 6 1579
Usually the *first time is really slow cause the assembly is loaded. The
next times should be faster. Serialization is still going to be a bit slow.
I think they made some improvements in Whidbey.
--
William Stacey, MVP http://mvp.support.microsoft.com
"_BNC" <_B**@nospam.net> wrote in message
news:q0********************************@4ax.com... I've got an ArrayList of objects that I'd like to save/retrieve as quickly as possible. Each item in the arraylist is an object with about 50 variable-length strings; many zero-length, some about 80 chars or so, if that matters.
I figured I'd set the [Serializable] attribute on the object and on the ArrayList and use standard Serialize() functions. This is just incredibly slow. Is that normal? Any other recommended approach?
The function itself is listed below, but I think it's boilerplate:
private bool Serialize(string Filename) { FileStream binfs; IFormatter ifmtr = new BinaryFormatter(); bool retval = true; binfs = new FileStream( Filename, // expect full path and file name FileMode.Create, FileAccess.Write, FileShare.None); try { ifmtr.Serialize(binfs, this); binfs.Close(); } catch (SerializationException ex) { // MessageBox.Show(ex.ToString()); retval = false; } return retval; }
Hi,
By default , Serailizable attribute does all the neccessary thing but i
would suggest to control the process of serialization, you can implement the
ISerializable interface and get your things done fast.
Pls go through my this article, which i hope wil help you http://www.codeproject.com/Purgatory...ion_in_NET.asp
regards
Nishith
"_BNC" wrote: I've got an ArrayList of objects that I'd like to save/retrieve as quickly as possible. Each item in the arraylist is an object with about 50 variable-length strings; many zero-length, some about 80 chars or so, if that matters.
I figured I'd set the [Serializable] attribute on the object and on the ArrayList and use standard Serialize() functions. This is just incredibly slow. Is that normal? Any other recommended approach?
The function itself is listed below, but I think it's boilerplate:
private bool Serialize(string Filename) { FileStream binfs; IFormatter ifmtr = new BinaryFormatter(); bool retval = true; binfs = new FileStream( Filename, // expect full path and file name FileMode.Create, FileAccess.Write, FileShare.None); try { ifmtr.Serialize(binfs, this); binfs.Close(); } catch (SerializationException ex) { // MessageBox.Show(ex.ToString()); retval = false; } return retval; }
On Mon, 8 Nov 2004 20:04:13 -0500, "William Stacey [MVP]"
<st***********@mvps.org> wrote: Usually the *first time is really slow cause the assembly is loaded. The next times should be faster. Serialization is still going to be a bit slow. I think they made some improvements in Whidbey.
I hope so. I was trying to replace a somewhat slow XML parser (the
original file was a proprietary XML format). I was shocked to find out
that the binary serialize was several times slower at storing the info
than the XML parser. That doesn't make much sense.
On Mon, 8 Nov 2004 20:04:13 -0500, "William Stacey [MVP]"
<st***********@mvps.org> wrote: Usually the *first time is really slow cause the assembly is loaded. The next times should be faster. Serialization is still going to be a bit slow. I think they made some improvements in Whidbey.
I hope so. I was trying to replace a somewhat slow XML parser (the
original file was a proprietary XML format). I was shocked to find out
that the binary serialize was several times slower at storing the info
than the XML parser. That doesn't make much sense.
No it doesn't. I wonder if something else is going on?
--
William Stacey, MVP http://mvp.support.microsoft.com
"_BNC" <_B**@nospam.net> wrote in message
news:85********************************@4ax.com... On Mon, 8 Nov 2004 20:04:13 -0500, "William Stacey [MVP]" <st***********@mvps.org> wrote:
Usually the *first time is really slow cause the assembly is loaded. The next times should be faster. Serialization is still going to be a bit
slow.I think they made some improvements in Whidbey.
I hope so. I was trying to replace a somewhat slow XML parser (the original file was a proprietary XML format). I was shocked to find out that the binary serialize was several times slower at storing the info than the XML parser. That doesn't make much sense.
No it doesn't. I wonder if something else is going on?
--
William Stacey, MVP http://mvp.support.microsoft.com
"_BNC" <_B**@nospam.net> wrote in message
news:85********************************@4ax.com... On Mon, 8 Nov 2004 20:04:13 -0500, "William Stacey [MVP]" <st***********@mvps.org> wrote:
Usually the *first time is really slow cause the assembly is loaded. The next times should be faster. Serialization is still going to be a bit
slow.I think they made some improvements in Whidbey.
I hope so. I was trying to replace a somewhat slow XML parser (the original file was a proprietary XML format). I was shocked to find out that the binary serialize was several times slower at storing the info than the XML parser. That doesn't make much sense. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: _BNC |
last post by:
I've got an ArrayList of objects that I'd like to save/retrieve as quickly
as possible. Each item in the arraylist is an object with about 50
variable-length strings; many zero-length, some about...
|
by: Nicole |
last post by:
Has anyone else experienced a dramatic slow down of performance with
their ADP's after upgrading to Service Pack 2 or above? The slowness
occurs exclusively when pulling data from SQL Server in...
|
by: Mike Nygard |
last post by:
I'm experiencing extremely slow response times in design mode of my
forms since moving to Access 2003. Simply dragging a button to a
different position on the form takes 30 seconds or more. The...
|
by: David Sworder |
last post by:
Hi,
I've created a UserControl-derived class called MyUserControl that is
able to persist and subsequently reload its state. It exposes two methods as
follows:
public void Serialize(Stream...
|
by: Dan |
last post by:
All I Am Attempting To Serialize An Object To An XML File.
Here Is The Code For That
public string SaveNewSurvey( MutualSurveyObject
mso_TempObject, int i_JobID )
{
string s_RootFileName;...
|
by: js |
last post by:
Does anybody knows how to solve the problem? I added
attribute to the following classes in
Microsoft.Practices.EnterpriseLibrary.Data namespace, but I still get
the error. Thanks.
...
|
by: cd~ |
last post by:
I can provide a test app, the news server won't allow me to post the files
because they are too large (93KB and 1.2KB)
I downloaded the ESRI ArcXml schema and generated the classes from the...
|
by: Tim |
last post by:
Could anyone tell me what this means and how do I correct it. Any
suggestions? Thanks!
Tim Richardson
IT Developer and Consultant
www.paladin3d.com
Unable to serialize the session state. In...
|
by: =?Utf-8?B?Qnlyb24=?= |
last post by:
When I try to serialize an instance of the LocationCell below (note Building
field) I get an error in the reflection attempt. If I remove the _Building
field it serializes fine. I tried renaming...
|
by: Gillard |
last post by:
i get an exeption and i do not know what else to do to continue
Dim sdf As New SaveFileDialog
With sdf
.AddExtension = True
.DefaultExt = ".record"
.FileName = Now.ToLongDateString
.Filter =...
|
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...
|
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...
|
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...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
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)...
|
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...
|
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....
|
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...
| |