Производительность HttpListener очень низкая в Ubuntu, но очень высокая в windows - PullRequest
1 голос
/ 03 марта 2020

do tnet core 3.1 HttpListener

Производительность того же кода в Ubuntu очень низкая, всего 20% от windows. Почему это?

 HttpListener web = new HttpListener();
        web.Prefixes.Add("http://+:" + 88 + "/");
        web.Start();
        var result = Encoding.UTF8.GetBytes("hello world!");

        while (true)
        {
            var context = web.GetContextAsync().Result;
            Task.Run(() =>
            {
                context.Response.StatusCode = 200;
                context.Response.ContentLength64 = result.Length;
                context.Response.OutputStream.Write(result, 0, result.Length);
                context.Response.OutputStream.Close();
                context.Response.Close();
            });

        }
...