I'm writing a JSON composer, but I'm not happy with the speeds I'm getting.
The input is Hash tables and/or object lists.
Here's a snippet of the code. 'de' is a DictionaryEntry from a Hash table and 'output' is the json string we are building.
if (de.Value.GetType() == typeof(Hashtable))
{
output += RenderObject((Hashtable)de.Value, level + 1, format);
}
This is basically how my whole code is built.
My test-case right now is a List containing 10 000 hash tables, each with 4 key/value pairs of different types.
On a crappy desktop computer it generated the whole string in exactly 60 seconds. The output was 927 kB.
I'm looking for advice on optimizing it and input on what kind of speeds I should be happy with. A whole minute to generate a <1mb json string is too slow, I think.
if (de.Value is IDictionary)