Through the introduction of the previous 2 articles, we must have found that dynamically compiled objects can only be invoked through reflection, but reflection is often a bottleneck in the performance of a program, this really can not break? The answer, of course, is no, and then I'll talk about how to tap the potential of dynamic compilation.
A little nonsense.
I just came to the blog park only about 1 weeks, yesterday to understand how to publish to the home page, first say sorry, yesterday's article has a few places to paste the source code incredibly few characters, a little inexplicable, it is no wonder that some people can not run, although it is a small error, but if carefully checked words can also be avoided, this is my mistake.
And one more thing, this dynamic compilation is a series of although there is no outline, do not know how to write a few, but the content must be gradual, so if you see the unreasonable place, please do not be surprised, perhaps I just to better understand, maybe the next one will be reconstructed this place.
Reply to the last article in the Bo Friends drift
Quote I just want to: say this efficiency is too slow, when the landlord can do close to Fastjson or Newton.json speed on the Cow fork
Fastjson is Java, I can not test, but in terms of newtonsoft.json efficiency than he is still possible, so in this series does not over before the patient look forward to it .... (Is this an advertisement?)
The book goes to the truth.
Through the introduction of the previous 2 articles, we must have found that dynamically compiled objects can only be invoked through reflection, but reflection is often a bottleneck in the performance of a program, this really can not break? The answer is, of course, negative.
So how do you get rid of reflection?
Look carefully before the "play Dynamic compilation" You can find that the previous 2 chestnuts compiled are static methods.
Back to yesterday's pest, the user resolution class that was statically compiled
Using BLQW;
Using System;
Using System.Collections;
Using System.Text;
public class _336090F4E7724D2585B07E79210DECB4
{
public static string A (User obj)
{
return new StringBuilder (). Append ("{\" uid\ ":")
. Append (Json.Converter2.FromGuid (system.guid) obj. UID))
. Append (", \" name\ ":")
. Append (Json.Converter2.FromString (System.String) obj. Name))
. Append (", \" birthday\ ":")
. Append (Json.Converter2.FromDateTime (System.DateTime) obj. Birthday))
. Append (", \" sex\ ":")
. Append (Json.Converter2.FromEnum (Enum) obj. SEX))
. Append (", \" isdeleted\ ":")
. Append (Json.Converter2.FromBoolean (System.Boolean) obj. isdeleted))
. Append (", \" loginhistory\ ":")
. Append (Json.Converter2.FromArray (IEnumerable) obj. Loginhistory). GetEnumerator ()))
. Append (", \" info\ ":")
. Append (json.tojson_2) (obj. Info))
. Append ("}"). ToString ();
}
}