Home > Uncategorized > XmlSerializer Cache

XmlSerializer Cache

Some benchmarks that shows the overhead of the XMLSerializerCache

var xs = new XmlSerializer(typeof(DataSet));

On a first call, this generates a cached serialization assembly. On my PC, this takes 0.2 seconds. However, on subsequent calls,
this line executes in 0.00006959 seconds.

This is how I timed this;

        private TimeSpan CreateXMLSerializer(int numberOf)
            var dtStart = DateTime.Now;
            var lNumber = Enumerable.Range(1, numberOf);
            foreach (var intIteration in lNumber)
                var xs = new XmlSerializer(typeof(DataSet));
            var dtEnd = DateTime.Now;
            return dtEnd – dtStart;

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: