Speed improvement and test of ASP output method

Source: Internet
Author: User
Tags date array final join client
Speed////////////////////////////////////////////////////
{The client template for testing}
////////////////////////////////////////////////////
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta name= "generator" content= "EditPlus" >
<meta name= "Author" content= "" >
<meta name= "Keywords" content= "" >
<meta name= "Description" content= "" >
</HEAD>

<BODY>
<script language= "VBScript" >
Dim t
T=timer
</script>
<!--here put the server test script-->
<script language= "VBScript" >
Document.Write "|" & (TIMER-T) ' Output the time taken by the client to fully accept all data
</script>
</BODY>
</HTML>
////////////////////////////////////////////////////
{The code for each script you tested}
////////////////////////////////////////////////////
//--------------------------------------------------
Test-js.asp
Use an array to collect all the character channeling and finally join the Join function
//--------------------------------------------------
<script language= "JavaScript" runat= "Server" >
var i,t,s;
var a=new Array (10000);
t= (New Date ()). GetTime ();
for (i=0;i<10000;i++) {
S+=string (i) + "\ n";
A[i]=string (i);
}
S=a.join ("\ n");
Response.Write (s);
Response.Write ("<br>" +string (New Date ()). GetTime ()-T);
A=null;
S=null;
</Script>
//--------------------------------------------------
////////////////////////////////////////////////////
//--------------------------------------------------
Test-js2.asp
//--------------------------------------------------
<script language= "JavaScript" runat= "Server" >
var i,t,s= "";
t= (New Date ()). GetTime ();
for (i=0;i<10000;i++) {
S+=string (i) + "\ n";
}
Response.Write (s);
Response.Write (New Date ()). GetTime ()-T);
A=null;
S=null;
</Script>
//--------------------------------------------------
////////////////////////////////////////////////////
//--------------------------------------------------
Test-js3.asp
Each data is obtained, and is immediately exported to the data stream.
//--------------------------------------------------
<script language= "JavaScript" runat= "Server" >
var i,t;
t= (New Date ()). GetTime ();
for (i=0;i<10000;i++) {
Response.Write (i+ "\ n");

}
Response.Write ("<br>");
Response.Write (New Date ()). GetTime ()-T);
</Script>
//--------------------------------------------------
////////////////////////////////////////////////////
//--------------------------------------------------
Test-js3.asp
This program creates a zero file and enters all the content into the file, and the final unified output
The component used to establish the zero file is the FSO
//--------------------------------------------------
<script language= "JavaScript" runat= "Server" >
var i,t;
t= (New Date ()). GetTime ();
var fso=server.createobject ("Scripting.FileSystemObject");/Create an FSO object
var f=fso. CreateTextFile (Server.MapPath ("Temp.txt"), true);//Create a zero file through the FSO object
for (i=0;i<10000;i++) {
F.writeline (i);
}
F.close ();
F=fso. OpenTextFile (Server.MapPath ("Temp.txt"), 1);
Response.Write (F.readall ())//Read the contents of a zero file
F.close ();
F=null;
Fso=null;
Response.Write ("<br>");
Response.Write (New Date ()). GetTime ()-T);
</Script>
//--------------------------------------------------
////////////////////////////////////////////////////
//--------------------------------------------------
Test-js5.asp
This program creates a zero file and enters all the content into the file, and the final unified output
The component used to establish the zero file is ADODB.stream
//--------------------------------------------------
<script language= "JavaScript" runat= "Server" >
var i,t;
t= (New Date ()). GetTime ();
var ado=server.createobject ("ADODB.") Stream ");
Ado. mode=3;//set to readable and writable
Ado. type=2;//set Content to text
Ado. Open ();
for (i=0;i<10000;i++) {
Ado. WRITETEXT (i+ "\ n");
}
Ado. SaveToFile (Server.MapPath ("Temp.txt"), 2);//Save to read
Response.Write (ADO. ReadText (-1));
Ado. Close ();
Ado=null;
Response.Write ("<br>");
Response.Write (New Date ()). GetTime ()-T);
</Script>
//-------------------------------------------



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.