473,399 Members | 3,832 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,399 software developers and data experts.

NameTable questions

Hello,

is there a way to disable or reset the entries in a NameTable?

Background is that is that i create small XmlElements and send them over
the wire with a TCP connection. I can't create XmlElements without
having a document. The XmlElements are only created, but never added to
the document. After i sent them they get disposed. In my code will be
lots of classes derived from Element which help me building my XML. The
problem here is that the NameTable blows up with each XmlElement i create.

Of course i could inherit all my classes from XmlDocument to solve this
issue. But the downside here would be that i have to use ImportNode to
build my XML and always create complete XmlDocuments which is very slow.
And compared to the first solution it needs much more memory. I wrote
some small test cases and profiled them for speed and memory comparisons.

Alex
Oct 11 '06 #1
5 2081
"Alexander Gnauck" <gn****@ag-software.dewrote in message
news:45***********************@newsspool2.arcor-online.net...
Hello,

is there a way to disable or reset the entries in a NameTable?

Background is that is that i create small XmlElements and send them over
the wire with a TCP connection. I can't create XmlElements without having
a document. The XmlElements are only created, but never added to the
document. After i sent them they get disposed. In my code will be lots of
classes derived from Element which help me building my XML. The problem
here is that the NameTable blows up with each XmlElement i create.

Of course i could inherit all my classes from XmlDocument to solve this
issue. But the downside here would be that i have to use ImportNode to
build my XML and always create complete XmlDocuments which is very slow.
And compared to the first solution it needs much more memory. I wrote some
small test cases and profiled them for speed and memory comparisons.
In terms of your performance tests, what did you see about the performance
of something like this:

private XmlDocument _theDocument = new XmlDocument();

....

public void SendElement(string name)
{
XmlElement el = _theDocument.CreateElement("");
_theDocument.AppendChild(el);
// Send el
_theDocument.RemoveChild(el);
}

Removing the element from the document might remove its name from the
nametable.

I'm assuming that you are creating many elements with different names, so
that the XmlNameTable fills up with many different names? It doesn't get
duplicate names, does it? Do you ever reach a steady state as to the number
of names in your application?

John
Oct 11 '06 #2
John Saunders wrote:
In terms of your performance tests, what did you see about the performance
of something like this:

private XmlDocument _theDocument = new XmlDocument();

...

public void SendElement(string name)
{
XmlElement el = _theDocument.CreateElement("");
_theDocument.AppendChild(el);
// Send el
_theDocument.RemoveChild(el);
}
i never added the Element to the document. So my tests look like this:

public void SendElement(string name)
{
XmlElement el = _theDocument.CreateElement("");
XmlElement el2 = _theDocument.CreateElement("");
....

el.AppendChild(el2);
...

// Send el
myConnection.Send(el); // is sending el.OuterXml
}
>
Removing the element from the document might remove its name from the
nametable.
see above
I'm assuming that you are creating many elements with different names, so
that the XmlNameTable fills up with many different names? It doesn't get
duplicate names, does it? Do you ever reach a steady state as to the number
of names in your application?
The element and attribute names are limited in the schema. But the
content is different, and this is what gets stored in the NameTable.
And of course they don't contain duplicates, which is the idea behind
the nametable.
If will try to append the element to the document and remove it after
sending and see if it helps.

Alex
Oct 11 '06 #3
Alexander Gnauck wrote:
If will try to append the element to the document and remove it after
sending and see if it helps.
didn't help. I looks like entries in the nametable will never be removed.

Alex
Oct 11 '06 #4
"Alexander Gnauck" <gn****@ag-software.dewrote in message
news:45***********************@newsspool3.arcor-online.net...
Alexander Gnauck wrote:
>If will try to append the element to the document and remove it after
sending and see if it helps.

didn't help. I looks like entries in the nametable will never be removed.
You've probably already thought of this, but you could create a new
XmlDocument object for each logical "chunk" of content, assuming the chunks
are large enough. You obviously wouldn't want to do this if it meant
creating 10,000 instances per second!

John
Oct 11 '06 #5
John Saunders wrote:
You've probably already thought of this, but you could create a new
XmlDocument object for each logical "chunk" of content, assuming the chunks
are large enough. You obviously wouldn't want to do this if it meant
creating 10,000 instances per second!
yes i did. In my tests this was 3-4 times slowerinon client and server
applications. On a server with high load i will have much more than
10.000 instances per second.

Alex
Oct 11 '06 #6

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

Similar topics

4
by: Colin Savage | last post by:
In my C# application I have an object model which can be loaded and saved into xml, not using serialization. When changes are made to the object model by the user interface, I use another thread to...
3
by: Colin Savage | last post by:
I am trying to work out the best way to use the NameTable class in my C# application. I am assuming that getting/adding a string to the nametable has the same overheads as comparing a string...
2
by: Mark Bosley | last post by:
There seems to be little interest in this object, the docs are wrong and it doesn't do much. Two years ago, it was pointed out that the documentation is nonsensical...
0
by: softwareengineer2006 | last post by:
All Interview Questions And Answers 10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP) I have listed over 10000 interview questions asked in interview/placement test papers for...
0
by: Fratt | last post by:
I have an xml document defined by a schema that includes roughtly 1100 types. When I go to deserialize the root type I notice that the xmlSerializer creates the nametable and adds all 1100 types...
0
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
2
by: freepdfforjobs | last post by:
Full eBook with 4000 C#, JAVA,.NET and SQL Server Interview questions http://www.questpond.com/SampleInterviewQuestionBook.zip Download the JAVA , .NET and SQL Server interview sheet and rate...
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
8
by: Krypto | last post by:
Hi, I have used Python for a couple of projects last year and I found it extremely useful. I could write two middle size projects in 2-3 months (part time). Right now I am a bit rusty and trying...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
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...

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.