CSHARPPROGLIB Telegram 6297
⏱️ Как ускорить асинхронный код в C#

Частая ошибка — писать асинхронные вызовы последовательно:
await GetUser();
await GetOrders();
await GetRecommendations();


Каждая операция ждёт предыдущую и если каждый запрос занимает по секунде, общее время = 3 секунды.

А можно иначе:
var userTask = GetUser();
var ordersTask = GetOrders();
var recsTask = GetRecommendations();

await Task.WhenAll(userTask, ordersTask, recsTask);


Все задачи стартуют сразу. Теперь общее время = 1 секунда (ожидание самой длинной операции).

Маленький приём — большая разница во времени выполнения.

🐸Библиотека шарписта

#sharp_view
Please open Telegram to view this post
VIEW IN TELEGRAM
👍39🥱911



tgoop.com/csharpproglib/6297
Create:
Last Update:

⏱️ Как ускорить асинхронный код в C#

Частая ошибка — писать асинхронные вызовы последовательно:

await GetUser();
await GetOrders();
await GetRecommendations();


Каждая операция ждёт предыдущую и если каждый запрос занимает по секунде, общее время = 3 секунды.

А можно иначе:
var userTask = GetUser();
var ordersTask = GetOrders();
var recsTask = GetRecommendations();

await Task.WhenAll(userTask, ordersTask, recsTask);


Все задачи стартуют сразу. Теперь общее время = 1 секунда (ожидание самой длинной операции).

Маленький приём — большая разница во времени выполнения.

🐸Библиотека шарписта

#sharp_view

BY Библиотека шарписта | C#, F#, .NET, ASP.NET




Share with your friend now:
tgoop.com/csharpproglib/6297

View MORE
Open in Telegram


Telegram News

Date: |

Other crimes that the SUCK Channel incited under Ng’s watch included using corrosive chemicals to make explosives and causing grievous bodily harm with intent. The court also found Ng responsible for calling on people to assist protesters who clashed violently with police at several universities in November 2019. The group also hosted discussions on committing arson, Judge Hui said, including setting roadblocks on fire, hurling petrol bombs at police stations and teaching people to make such weapons. The conversation linked to arson went on for two to three months, Hui said. Telegram offers a powerful toolset that allows businesses to create and manage channels, groups, and bots to broadcast messages, engage in conversations, and offer reliable customer support via bots. Matt Hussey, editorial director of NEAR Protocol (and former editor-in-chief of Decrypt) responded to the news of the Telegram group with “#meIRL.” The channel also called on people to turn out for illegal assemblies and listed the things that participants should bring along with them, showing prior planning was in the works for riots. The messages also incited people to hurl toxic gas bombs at police and MTR stations, he added.
from us


Telegram Библиотека шарписта | C#, F#, .NET, ASP.NET
FROM American