VBScript with JScript who is afraid who (4)

Source: Internet
Author: User
Tags array contains execution mixed regular expression
Turn from: chinabyte

The above 第一、三、四、六 several algorithms have a common feature: either one of the languages has a unique function, or in regular expression matching and distance computing, the difference between the two languages is very large enough to become a very meaningful mixed language programming test project. This gives us two additional scenarios for testing these algorithms: calling inline JScript functions in VBScript as the base language, and calling inline VBScript functions in the base language of JScript. Examples of test code are as follows (test scenario: String flip, in JScript as the base language, VBScript inline):
<% @Language =jscript% >
< SCRIPT language= "VBScript" runat= "Server" >
Function STRREVVB (Strparm)
StrReverse (Strparm)
End Function
</script >
<%
STRREVVB ("String reversal")
% >




All other routines contain only the functionality provided by the language itself, which is tested only in pure VBScript and in pure JScript version of the code. In other words, these routines are of little value to any case of mixed-language programming rationality tests.

The first set of tests runs the first six routines, and for each run, the test tools page is called 1000 times for the call to the ASP page that contains the test routines (Server.Execute). In other words, if a run calls a page written by both scripting languages 1000 times, the cost of invoking the ASP engine and the individual scripting engines reaches 1000. Although this approach results in the cost of the script engine affecting the test result, the results of the test we obtained are more reflective of the actual application. That is, although we can do 1000 times a string flip within a single page, it's closer to actually putting the code and other code on the same page and then having the page run thousands of times.

The second set of tests runs all eight routines, and the test Tools page executes only 1 times per run, but the test page itself contains loops. String flips and simple math calculations are run 10,000 times in their respective ASP pages. The pattern matching operation was performed 1,000 times. String lookup, distance calculation, and two displacement operations (move left and right) operations are performed 10,000 times. In the array initialization test, the program declares an array of 100,000 elements, initializes it with a For loop, and assigns the value of the counter to each element. In the recordset traversal test, the program traverses the recordset through the While Outer loop (the recordset contains 830 records), through the For Each ... Next loops through each field of a single record (14 fields per record).

The second set of tests provided a number of scenarios that focused more on the execution overhead of the test routines themselves, thus giving a clearer picture of the pros and cons of the two scripting languages in terms of execution time.



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.