kessler / node-regedit

Read, Write, List and do all sorts of funky stuff to the windows registry using node.js and windows script host
MIT License
277 stars 45 forks source link

performance when using ExecMethod vbscript api #9

Open kessler opened 9 years ago

kessler commented 9 years ago

Copied directly from #7 :

See cscript-registry-benchmark and its output.

Calling registry.GetStringValue directly (eg, agnostic mode) is roughly 2x as fast as registry.ExecMethod_("GetStringValue", ..) with a "__ProviderArchitecture" flag / context.

The relevant bit of the output is (the third column is the difference to the agnostic duration):

Agnostic:                     2.219 sec  
64-bit:                       4.797 sec   +2.578 
64-bit (predefined method):   3.906 sec   +1.688 

As the third row shows, a small speed gain can be made by reusing the method object:

' Initialize
set method = registry.Methods_("GetStringValue")

' Then later ..
Set params = method.Inparameters
params.hDefKey = ..

Instead of doing registry.Methods_("GetStringValue").Inparameters each time.

PS. You might see "20000 sec" in the output, that's a formatting mistake, should be 2 seconds.