Json.net slow serialization and deserialization

后端 未结 3 1030
南笙
南笙 2021-02-01 09:24

I have a problem - Json.Net serializing my objects realy slow. I have some basic class:

public class authenticationRequest
{
    public string userid;
    public         


        
3条回答
  •  耶瑟儿~
    2021-02-01 09:49

    What I believe is happening here is that you are getting a delay when the Json.Net library is being loaded. You should try compiling in Release mode to see if things speed up considerably, as this should prevent symbols from being loaded (which can add to the library load time).

    If it is still an issue, find a good time in your app that you can do a dummy serialization (perhaps even on a background thread) to force the library to load. That has a bit of code-smell to it, though, so there may be a better way of forcing the load, but that's a brute force method that should work all the time.

提交回复
热议问题