Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

json.net performance over a 77kb json string

I am profiling my ASP.NET MVC app and when I hit my local version on IIS and I have noticed that deserializing an object of about 77kb takes around 100ms, is this expected?

Also the CPU seems to max out while im profiling, is the task of deserializing very intense, or should I be looking elsewhere?

Thanks for any help you can give.

like image 494
Mark Avatar asked Nov 04 '22 07:11

Mark


1 Answers

The complexity of the object usually plays a major role with regards to deserializing. Objects that contain child objects in a recursive pattern will eat CPU and memory to parse correctly.

A simple Name:Value map can become much more complex if the Value is another map (object) of Name:Value. If this type of recursion is going on you may want to try denormalizing (making a Name:[primitive]Value) your JSON so it's easier for the system to parse.

Denormalizing with respect to MVC (rdbms data) may be a bit difficult. Flattening many-to-many relationships isn't feasible in many cases.

You could try comparing JSON.net to the built-in JavaScriptSerializer and see if you can get an improvement.

like image 87
Louis Ricci Avatar answered Nov 09 '22 12:11

Louis Ricci