How to decrease the page load time in ASP.NET application?

前端 未结 11 599
独厮守ぢ
独厮守ぢ 2020-12-25 08:33

How to decrease the page load time in ASP.NET application? What should be the precautions and specially when we are interacting with databases

e.g.

  1. w
相关标签:
11条回答
  • 2020-12-25 09:14

    The most important thing before doing any work on optimizing, is indicating what needs to be optimized. Thousends of tips to optimize can be posted here, so it's better to find what your performance problem is, and ask a more specific question for help to optimize what you need. You can optimize 3 parts of a web application:

    Serverside performance: Indicate the largest bottleneck (a profiler is an easy option to do that). Optimize the bottleneck. Optimizing smaller problems, or optimizing without measuring the amount of time can be a waste of time when the large one is still there.

    Client side performance: Take the advise from tools like yslow, or google page speed.

    Bandwidth: Send the smallest amount of data to the user as possible in the least amount of requests as possible.

    0 讨论(0)
  • 2020-12-25 09:16

    This below information used to decrease the page load time

    1. Remove unwanted line space while hosting site.
    2. Merge all inline css file into one common .css file.
    3. Merger all inline Java scripts into one common .js file and add reference to this file whenever you require.
    4. use compress Javascript and CSS files.
    5. Try using less images with less size in your web page.
    0 讨论(0)
  • 2020-12-25 09:20

    Some of the key "take-aways" from TechEd 2010 North America:

    • Caching is key to performance, consider your caching strategy very carefully.
    • Disable viewstate if possible.
    • Set <compilation debug=”false"> in web.config when deploying the app.
    • Consider CDN's or subdomains for graphics and other static content.
    • Place javascript at the bottom of the page, CSS at the top.
    • Consider CSS sprites for icons and other "small" graphics.

    You can watch the sessions online here, they're both highly recommended:

    • My Web Site Is So Slow...and I Don’t Know What to Do about It! with Thomas Deml
    • Web Load Testing with Microsoft Visual Studio 2010 with Richard Campbell
    0 讨论(0)
  • 2020-12-25 09:25

    Always use request to load concept in application. Try to avoid unwanted database hit on the page load.if you have large amount of data on page load then you can go with Ajax request call.

    0 讨论(0)
  • 2020-12-25 09:26
    • Use MS Visual Studio 2010 which helps you in optimizing your .NET code for better performance.
    • CSS sprites are very useful when you have a lot of images in background.
    • Compress the contents of JavaScript files using gZip compresser and CSS file by removing white spaces and comments.
    • Avoid HTML comments as they are visible to client side by "View Source" option in browser, which will also reduce the file size.
    • Put most of the unnecessary JavaScript at the bottom of the page. For better performance dynamically load the JavaScript references after loading contents on your page.
    0 讨论(0)
  • 2020-12-25 09:29
    • Try to minimize ViewState as much as possible or keep it on the server
    • Use caching of data or portions on your page by using outputcaching of user controls
    • Bundle scripts and css as much as possible

    Always measure after you refactored something to see if it makes a difference.

    Also please take a look here for more information.

    • Improving ASP.NET performance from Microsoft Patterns & Practices.

    Grz, Kris.

    0 讨论(0)
提交回复
热议问题