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 the answer in msdn, so I tested it myself.
Object:
Test object: Test. WSC. There are 320 lines in total, of which there are 222 lines of code. The call method is GetObject ("Script: C:/test. WSC") without executing the code.
Reference object: Registered ADODB. recordset. Call method Createobject ("ADODB. recordset ").
Test method:
The same program cyclically calls the object several times, and then returns the number of cycles/number of cycles to obtain 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, method A is at least one order of magnitude faster than method B. Both methods tend to be a fixed value (B may be related to the size of WSC compilation, however, the speed of a does not match the cache efficiency. Why ?)
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 same program, if 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 use of WSC.