VBScript with JScript who is afraid who (1)

Source: Internet
Author: User
Tags execution expression regular expression relative
Turn from: chinabyte

Which language is better for VBScript and JScript in an ASP environment? This article tests the time required by both scripting languages to complete common operations, analyzes their strengths and weaknesses, and draws some noteworthy conclusions based on the test results.
Author: Cactus Studio

Original source: http://www.asptoday.com/articles/20000920.htm

Choosing a scheme system involves many factors, often related to cost advantage analysis based on performance, capacity, maintainability, employee experience, existing foundation, and personal preference. In a typical MICROSOFT/IIS implementation, this consideration continues to expand into the role of ASP in collaborating with a large number of different COM + components: At an extreme, performance is far more convenient than programming and maintenance, and ASPs are only "binders" for integrating business logic and user interface At the other extreme, the ease with which programming and maintenance can be achieved exceeds performance, and the ASP itself is used to implement many business logic.

This consideration can even go a step further by analyzing the relative strengths and weaknesses of the ASP's two main scripting languages (VBScript and JScript). Functionally, people who are in favor of JScript can say that JScript offers advantages such as better error control, inheritance, bit manipulation, and a client-side, server-wide scripting language, and conversely, those in favor of VBScript can say that VBScript has its own characteristics, such as the extremely rich localization ability, the case independent code, the more simple intuitive syntax (certainly, C programmer to this point will have the objection). In extreme words, we can not only achieve such a different ASP page on the same site to analyze the strengths of the two languages, but also within a single ASP page!

Although it is sometimes possible to simplify programming with multiple scripting languages within the same ASP page, it is bad for performance. With a cursory consideration of this issue, we know that running this ASP page requires a two script engine to be started and cached, greatly increasing overhead. (And even if we can ignore performance issues, mixing the two scripting languages is inherently unsafe because the engine buffering affects the order of execution.) In short, ASP pages that use two or more scripting engines may not execute sequentially if the developer is not careful. )

This article is going to delve into the performance problems of VBScript on this Windows 2000/asp3.0 platform compared to JScript (and VBScript plus JScript). Specifically, this article will answer the following questions:

is one of the scripting languages faster than the other?
If so, under what circumstances and why?
Is there a scenario where mixing two scripting languages can reduce execution time? (Is this situation realistic?) )
If a language is always faster than the other, is the speed difference large enough to be a factor in choosing a scripting language?
To answer these questions, we will compare the execution time of the 8 typical routines, which are written in both VBScript, JScript, and both (in combination, a scripting language as the primary language of an ASP page (the Basic language), which invokes an inline function written by another scripting language). These 8 routines are:

String flip (upside down),
Search for another string within a string,
Regular expression pattern matching,
Displacement operation,
Simple mathematical calculations,
Complex mathematical calculations,
Array initialization,
ADO recordset traversal.
Analysis method

Given that there are so many factors affecting Web application performance, and the real difficulty may also be to configure a fully controlled (also known as "unrealistic") test environment, the purpose of this paper is not to give the two language performance comparison of the exact measure of the difference, but to give a variety of programming programs under the performance of the relative advantages of reliable instructions.

That is to say, our goal is not to know that JScript's regular expression pattern-matching operations are 23% faster than VBScript's, and our main concern is whether there is such a difference, how much this difference is generally apparent, what the difference is, and why.

This article only gives summary (average) data. If you want to see more specific data, you can find the original test results in Data.xls. Data.xls can be downloaded from the back of this 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.