天哪!!!!不试不知道。试了吓一跳!!!!!
swans 2002-05-16 06:33:05 <%
dim x,y
response.write now() & "<BR>"
for x=1 to 20000000
y=x
next
response.write y & "<BR>"
response.write now() & "<BR>"
%>
就这一小段循环二千万次的程序。做成.dll组件运行比asp文件快20陪。
----程序清单---
----delphi的主要方法----------------
procedure TMyAspObject.MyAspRequest;
var
x:integer;
y:integer;
begin
y:=0;
response.Write(y);
for x:=1 to 20000000 do
begin
y:=x;
end;
response.Write(y);
end;
-----------------------
----asp中调用----
<HTML>
<BODY>
<%
Set a = Server.CreateObject("Project1.MyAspObject")
response.write now() & "<BR> '输出运行前是间
a.MyAspRequest() '调用方法
response.write "<BR>" & Now() '输出运行后时间
a.close()
set a=nothing
%>
</BODY>
</HTML>
---------------------------------------
------asp程序-------
见最前面的程序
--------------------
结果
--组件-------------
2002-5-16 18:12:35
20000000
2002-5-16 18:12:35
不到一秒。
----asp----------------
2002-5-16 18:15:00
20000000
2002-5-16 18:15:21
且CPU占用率为100%
--------------------------
天哪!!哪位大侠解释一下原理。。。。