仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1621|回复: 19
打印 上一主题 下一主题

[学习教程] ASP网页设计asp内存和速度优化,第一局部(英文版)...

[复制链接]
谁可相欹 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-2-3 23:35:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
ASP一般认为只能运行在IIS上,正如前面所提到的,这并不是十分正确,事实上,ASP也能运行在Apache上。Apache ASP可在任意Apache服务器上运行有限的ASP功能,所需做的,只需打开mod_perl。速度|优化   Memory and Speed Optimization with ASP - Part I
It is an all to familiar problem: optimizing the memory and speed of your web sites. Maybe you have been, more than once a week, in the situation where your web server stopped giving you any ASP page, while the HTML pages were correctly displayed. One of the challenges faced by the web developers is how to create a fast (usually a faster that the one you have) application out of a series of HTML and ASP pages.

When programming ASP pages, memory and speed optimization can be acquired in two different ways. Because HTML pages are not processed at the server-side, we will talk more about memory and speed optimization of ASP pages:

By programming good ASP pages. This article is all about optimizing by writing good ASP pages.
By configuring the web server. We will cover this topic in another article.
When talking about optimizing ASP pages, we should start from the deepest level: basic variables.

One of the biggest differences between Visual Basic (VB) and ASP programming is the variable declaration. VB is a programming language, so you can define variables of a specific type:

Dim I as Integer        ' Integer Declaration
Dim a$             ' String declaration
Dim objMyCom as Object     ' Object Declaration
Dim var as Variant         ' Variant declaration

While ASP is a scripting language, where the only available type is VARIANT type. All the variables declared in ASP are of type VARIANT . Unfortunately, this makes all the operations slower, because the work with VARIANT is slower. The system has to first evaluate the type of the variant, convert it to the most appropriate of the operation that is to be done, and then make the operation.

VARIANT is a very smart type of variable. It has great capabilities of storing EMPTY and NULL values, along with any types of data, such as (integers, doubles, strings, currency and dates, arrays or objects).

Optimizing memory and speed when working with ARRAYS.
ASP programmers are usually not very good friends with ARRAYS. Using ARRAYS is more common to VB programmers that use them to store data. As little as you use arrays, you should have in mind the following way of optimizing array access:

Arrays are made from continuous blocks of memory. Reading and writing an item of an array is slower than accessing a simple variable. For each access to an item in an array, the runtime environment has to determine the position of the item in the memory, based on the first element of the array and the index. Therefore, it's faster to read/write a variable, than an array item. Therefore, if you need to use the same array item in a loop repeatedly, you'd better assign the item to a variable and use that variable instead.

E.g. :

<%
' this will calculate for each element, the value a(i) = 2i ( = 2 * 2 * 2 - for i times)
Dim a(20)     ' The array
Dim i,j    ' indexes
Dim tempVar     ' a temporary variable
' Non-optimized Array Access:
For i = lBound(a) to uBound(a)
     a(i) = 1
     For j = 2 to i
     a(i) = a(i) * 2
     next j
Next
' Optimized Array Access
For i = lBound(a) to uBound(a)
     tempVar = 1
     For j = 2 to i
     tempVar = tempVar * 2
     next j
a(i) = tempVar
Next
%>

Because of the way of calculating the position of an element in memory, access to items in bidimensional arrays is very slow when compared to accessing items in single dimensional arrays. Think about this when designing your algorithms.

A good way of optimizing speed of multidimensional arrays is to reduce them to a single dimensional array. Instead of using a 10 by 10 matrix, try to use a 100-element array to speed up access. In this case, you have to manually find your items in the array. If you use i and j as indices, and you used to access an element like A(i, j), the new way of accessing the items will be A((i*10)+ j), where i and j are the original indices.

In ASP there are few ways of declaring arrays. The difference between the declaration method is the way in which ASP allocates and uses memory.

1. Dim A (10) ' declaration of static array with 10 elements


Access to its i</p>  ASP在国内异常流行,因为国内大多使用的是盗版的Windows和盗版的SQLServer,而ASP+COM+SQLServer实际上也是一种不错的搭配,其性能也不输于PHP+MYSQL,特别是Windows系统和SQLServer都有图形界面,比APACHE和MYSQL易于维护,因此对于不重视知识产权的国家来说也是一种不错的选择。
愤怒的大鸟 该用户已被删除
沙发
发表于 2015-2-4 03:07:09 | 只看该作者
运用经典的例子。并且自己可以用他来实现一些简单的系统。如果可以对他进行进一步的修改,找出你觉得可以提高性能的地方,加上自己的设计,那就更上一个层次了,也就会真正地感到有所收获。
admin 该用户已被删除
板凳
发表于 2015-2-4 22:44:00 | 只看该作者
如何更好的使自己的东西看上去很不错等等。其实这些都不是问题的实质,我们可以在实践中不断提升自己,不断充实自己。
深爱那片海 该用户已被删除
地板
发表于 2015-2-17 22:28:45 | 只看该作者
他的语法和设计思路和VB完全相同,导致很多ASP的书都留一句“相关内容请参考VB的相关教材....”更糟糕的是,相当多的ASP教程混合了Javascript,VBscript等等脚本语言,搞的初学者。
再见西城 该用户已被删除
5#
发表于 2015-2-18 00:47:55 | 只看该作者
那么,ASP.Net有哪些改进呢?
透明 该用户已被删除
6#
发表于 2015-2-19 00:49:56 | 只看该作者
我想问如何掌握学习节奏(先学什么再学什么)最好详细点?
变相怪杰 该用户已被删除
7#
发表于 2015-3-6 08:33:17 | 只看该作者
先学习用frontpage熟悉html编辑然后学习asp和vbscript建议买书进行系统学习
爱飞 该用户已被删除
8#
发表于 2015-3-7 12:46:30 | 只看该作者
Application:这个存储服务端的数据,如果不清除,会直到web应用程序结束才清除(例如重启站点)
柔情似水 该用户已被删除
9#
发表于 2015-3-7 19:31:24 | 只看该作者
以上是语言本身的弱点,在功能方面ASP同样存在问题,第一是功能太弱,一些底层操作只能通过组件来完成,在这点上是远远比不上PHP/JSP,其次就是缺乏完善的纠错/调试功能,这点上ASP/PHP/JSP差不多。
金色的骷髅 该用户已被删除
10#
发表于 2015-3-11 01:18:11 | 只看该作者
我们必须明确一个大方向,不要只是停留在因为学而去学,我们应有方向应有目标.
再现理想 该用户已被删除
11#
发表于 2015-3-13 01:07:19 | 只看该作者
学习ASP其实应该上升到如何学习程序设计这种境界,其实学习程序设计又是接受一种编程思想。比如ASP如何学习,你也许在以前的学习中碰到过。以下我仔细给你说几点:
老尸 该用户已被删除
12#
发表于 2015-3-17 09:10:41 | 只看该作者
我想问如何掌握学习节奏(先学什么再学什么)最好详细点?
若相依 该用户已被删除
13#
发表于 2015-3-21 21:55:18 | 只看该作者
我认为比较好的方法是找一些比较经典的例子,每个例子比较集中一种编程思想而设计的。
小魔女 该用户已被删除
14#
发表于 2015-4-6 02:20:39 | 只看该作者
我可以结合自己的经验大致给你说一说,希望对你有所帮助,少走些弯路。
山那边是海 该用户已被删除
15#
发表于 2015-4-6 16:53:21 | 只看该作者
Application:这个存储服务端的数据,如果不清除,会直到web应用程序结束才清除(例如重启站点)
莫相离 该用户已被删除
16#
发表于 2015-4-6 17:03:12 | 只看该作者
ASP(ActiveServerPages)是Microsfot公司1996年11月推出的WEB应用程序开发技术,它既不是一种程序语言,也不是一种开发工具,而是一种技术框架,不须使用微软的产品就能编写它的代码,能产生和执行动态、交互式、高效率的站占服务器的应用程序。
17#
发表于 2015-4-12 10:33:21 | 只看该作者
不是很难但是英文要有一点基础网上的教程很少有系统的详细的去买书吧,另不用专门学习vb关于vbscript脚本在asp教材都有介绍
冷月葬花魂 该用户已被删除
18#
发表于 2015-4-16 00:10:07 | 只看该作者
跟学别的语言一样,先掌握变量,流程控制语句(就是ifwhileselect)等,函数/过程,数组
海妖 该用户已被删除
19#
发表于 2015-5-5 01:30:21 | 只看该作者
接下来就不能纸上谈兵了,最好的方法其实是实践。实践,只能算是让你掌握语言特性用的。而提倡做实际的Project也不是太好,因为你还没有熟练的能力去综合各种技术,这样只能使你自己越来越迷糊。
飘灵儿 该用户已被删除
20#
发表于 2015-5-9 06:06:18 | 只看该作者
我认为比较好的方法是找一些比较经典的例子,每个例子比较集中一种编程思想而设计的。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-12-22 19:13

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表