A step towards a faster Web: Early flushing in c#.net

A simple demonstration to Early flushing in dotnet.

Kumar Swapnil
Jan 12, 2020

Flushing, Early flushing, head flushing or Progressive HTML is when the server sends the initial part of the HTML document to the client before the entire response is ready. All major browsers start parsing the partial response.If done correctly, the browser won’t sit idle after requesting your page, rather, it can start process other important things in the meantime, like requesting static assets which would be used later on the site. It could give a significant perceived performance gain.
In this given example, I have used Thread.Sleep(200). This could be the time where your page does heavy database calls and other computation.

HomeController.cs

_HeadPart.cshtml

Index.cshtml

Results With Early Flushing:

Results Without Early Flushing

Originally published at https://dev.to on January 12, 2020.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Kumar Swapnil
Kumar Swapnil

Written by Kumar Swapnil

Wallflower | Tsundoku | ❣️ anime and crypto

Responses (1)

Write a response