WSC call Efficiency Test

Source: Internet
Author: User

Background:
The MS system packages scripts in a certain format and then compiles them to provide external services through the COM interface, referred to as WSC. WSC can be called in the same way as COM, but it is written in text mode, so it is easy to use and maintain. However, there is a problem here. Because WSC is written in text mode, each call must be re-compiled, which will definitely lead to a slow speed. At Ms level, there will certainly be a cache between compilation and calling, but what scope does this cache take effect? I did not find it in msdn, so I tested it myself.

Object:
Tested by: Test. WSC, which contains 320 rowsCodeRow 3: Call GetObject ("Script: C:/test. WSC ").
Reference object: Registered ADODB. recordset. Call method Createobject ("ADODB. recordset ").

 

Test method:
Call the object several times, and then set the number of cycles/number of cycles to get the number of seconds consumed for each call.
There are two test types: A: Do not clear the last object before calling, that is, there is always an instance in the memory; B: Clear the last object before calling (set OBJ = nothing ).

 

The test results are as follows:
[500 times]
Normal ---> A: 0 B: 0
Getwsc ---> A: 0 B:. 014
[1000 times]
Normal ---> A: 0 B: 0
Getwsc ---> A:. 001 B:. 014
[2000 times]
Normal ---> A: 0 B: 0
Getwsc ---> A:. 0015 B:. 015
[4000 times]
Normal ---> A: 0 B: 0
Getwsc ---> A:. 001 B:. 0165.
[8000 times]
Normal ---> A: 0 B: 0
Getwsc ---> A:. 00125 B:. 0165
[16000 times]
Normal ---> A: 0 B:. 0000625
Getwsc ---> A:. 001 B:. 016
[32000 times]
Normal ---> A:. 00003125 B:. 00003125
Getwsc ---> A:. 001125 B:. 015375
[64000 times]
Normal ---> A:. 000046875 B:. 000046875
Getwsc ---> A:. 001015625 B:. 014890625

Data comparison:
1. The call time of COM remains unchanged regardless of method A and method B.
2. When WSC is called, the method is at least one order of magnitude faster than the B method. Both methods tend to be a fixed value (is it related to the WSC compilation scale ?)
3. When calling method A, COM is faster than WSC by two orders of magnitude. The difference between Method B and WSC is huge.

Conclusion:
In the sameProgramIf you call the same WSC multiple times, do not setnothing to release the object before the end of all calls.

Appendix:
Through other tests, it is found that the same WSC exists in different processes (threads are not tested) and calls have no influence on each other. This seems to indicate that the cache of scrobj. dll is only for callers. However, does the same WSC calling efficiency affect the performance of ASP running in thread mode on different pages ??? Not tested yet. I believe this is critical to the efficiency of ASP using WSC.

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.