我的Web应用程序加载速度很慢 [英] My web application loading very slow

查看:235
本文介绍了我的Web应用程序加载速度很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在c#中有一个小型网络应用程序我面临一个问题加载速度非常慢我不知道要做什么可以请你建议任何一个对我非常需要



我尝试了什么:



i在c#中有一个小型Web应用程序我面临一个问题加载非常慢我不知道你能做什么可以请你建议任何一个人都非常需要我

i have one small web application in c# i am facing one trouble loading is very slow i don't know wat to do can u please suggest any one is very needful to me

What I have tried:

i have one small web application in c# i am facing one trouble loading is very slow i don't know wat to do can u please suggest any one is very needful to me

推荐答案

注释所有功能代码并开始只在几个功能步骤中发表评论一步之后。然后你找到了你的瓶颈。



最常见的错误是在显示任何内容之前等待所有数据加载。



常见解决方案:在额外的线程中进行加载或任何耗时的工作。
Comment all function code out and begin to comment in only a few functions step after step. Then you find your bottleneck.

Most common mistake is to wait til all data is loaded before show anything.

Common solution: Make the loading or any time consuming work in an extra thread.


首先确定问题是否是使用服务器代码,下载呈现页面所需资源所花费的时间,或呈现页面所需的时间。浏览器开发人员工具将为您提供以下帮助:



衡量资源加载时间  | 网络  |  Google Developers [ ^ ]



如果是需要很长时间的服务器代码,请使用分析器,或类似一瞥 [ ^ ],看看花了多少时间。最可能的罪魁祸首是数据库查询,在这种情况下,您需要优化查询和索引。



如果是下载资源所需的时间,减少资源的大小。优化您的图像。缩小任何样式表和脚本文件。在IIS中打开压缩。看看你是否可以使用延迟加载来减少初始命中。



如果是渲染时间,那么它有点棘手。您需要尝试减小HTML的大小,并尝试找到简化它的方法。
Start by determining whether the problem is with the server code, the time it takes to download the resources required to render the page, or the time it takes to render the page. The browser developer tools will help you with this:

Measure Resource Loading Times  |  Web  |  Google Developers[^]

If it's the server code that's taking a long time, use a profiler, or something like Glimpse[^], to see what's taking the time. The most likely culprit will be database queries, in which case you'll need to optimise the queries and indexes.

If it's the time it takes to download the resources, reduce the size of the resources. Optimise your images. Minify any stylesheets and script files. Turn on compression in IIS. See if you can use lazy-loading to reduce the initial hit.

If it's the rendering time, then it's a bit trickier. You'll need to try to reduce the size of your HTML, and try to find ways to simplify it.


您需要了解您的代码正在做什么以及它在哪里花费时间。而且你是唯一能够找到的人,因为我们没有你的应用程序。

分析(计算机编程) - 维基百科 [ ^ ]

性能分析工具列表 - 维基百科 [ ^ ]
You need to understand what your code is doing and where it spend time. And you are the only one able to find out because we don't have your app.
Profiling (computer programming) - Wikipedia[^]
List of performance analysis tools - Wikipedia[^]


这篇关于我的Web应用程序加载速度很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆