SOAP serialization is too slow to accept
-
well, although i like to store my data into xml style, i find the .net's SOAP serialization is too slow to accept. To state my opinion i think it better to show you what i am doing. althouth i hate to take up too much space in codeproject. i write a simple xml schema as example a schema to describe a book ---- book.xsd ====================================================================== Comment describing your root element ====================================================================== a implementation of schema ---- book.xml ======================================================================
first first article
second second article
====================================================================== Framework provide a tool call xsd.exe to get a class from schema, I take it make book.cs ====================================================================== using System.Xml.Serialization; /// [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)] public class article { /// public string title; /// public string @abstract; /// [System.Xml.Serialization.XmlAttributeAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType="ID")] public string id; } /// [System.Xml.Serialization.XmlRootAttr
-
well, although i like to store my data into xml style, i find the .net's SOAP serialization is too slow to accept. To state my opinion i think it better to show you what i am doing. althouth i hate to take up too much space in codeproject. i write a simple xml schema as example a schema to describe a book ---- book.xsd ====================================================================== Comment describing your root element ====================================================================== a implementation of schema ---- book.xml ======================================================================
first first article
second second article
====================================================================== Framework provide a tool call xsd.exe to get a class from schema, I take it make book.cs ====================================================================== using System.Xml.Serialization; /// [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)] public class article { /// public string title; /// public string @abstract; /// [System.Xml.Serialization.XmlAttributeAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType="ID")] public string id; } /// [System.Xml.Serialization.XmlRootAttr
Execute the read more than just one time to get the real amount of time it takes. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
-
well, although i like to store my data into xml style, i find the .net's SOAP serialization is too slow to accept. To state my opinion i think it better to show you what i am doing. althouth i hate to take up too much space in codeproject. i write a simple xml schema as example a schema to describe a book ---- book.xsd ====================================================================== Comment describing your root element ====================================================================== a implementation of schema ---- book.xml ======================================================================
first first article
second second article
====================================================================== Framework provide a tool call xsd.exe to get a class from schema, I take it make book.cs ====================================================================== using System.Xml.Serialization; /// [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)] public class article { /// public string title; /// public string @abstract; /// [System.Xml.Serialization.XmlAttributeAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType="ID")] public string id; } /// [System.Xml.Serialization.XmlRootAttr
Maybe you should write this up as an article. You could elaborate a bit more. I'm always interested in unique ideas like this, but you need to compare and contrast a bit more between the strengths and weaknesses of SOAP as opposed to your concept. "There's a slew of slip 'twixt cup and lip"
-
Execute the read more than just one time to get the real amount of time it takes. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
I have tried it many time. Only the first time cost much more almost 3 second. i think it will be caused by some dll or server be loaded or something like JIT in .net. But in the sequent runs , it cost 0.56 second around. maybe soap serializer must take so long to prepare for a procession. I still not use it on somethink like webservice. In that situation 1 second is quite unacceptable i think.
-
well, although i like to store my data into xml style, i find the .net's SOAP serialization is too slow to accept. To state my opinion i think it better to show you what i am doing. althouth i hate to take up too much space in codeproject. i write a simple xml schema as example a schema to describe a book ---- book.xsd ====================================================================== Comment describing your root element ====================================================================== a implementation of schema ---- book.xml ======================================================================
first first article
second second article
====================================================================== Framework provide a tool call xsd.exe to get a class from schema, I take it make book.cs ====================================================================== using System.Xml.Serialization; /// [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)] public class article { /// public string title; /// public string @abstract; /// [System.Xml.Serialization.XmlAttributeAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType="ID")] public string id; } /// [System.Xml.Serialization.XmlRootAttr
What you have is not SOAP, since SOAP is a specialized version of XML; but thats a minor detail. What is happening is the .NET framework is creating a class at runtime to serialize the data. This is why after the first time you serialize the class there is a delay; it is creating and compiling code then caching it away. If speed is that incredibly important search through the DOTNET mailing list archives and see if anyone had figured out how to keep that serializer class after the program has run. I remember some people working on it, they had gotten pretty far with it too. I do not remember when the discussion about it was, but I know it has been since early February. Hope that gives you some idea what is going on :) Just out of curiosity do you see the speed problem with the SOAP formatter? IIRC the SOAP formatter just uses reflection to generate the packet rather than creating a class at runtime. James Sonork ID: 100.11138 - Hasaki "I left there in the morning with their God tucked underneath my arm their half-assed smiles and the book of rules. So I asked this God a question and by way of firm reply, He said - I'm not the kind you have to wind up on Sundays." "Wind Up" from Aqualung, Jethro Tull 1971