Question

Javascript Objects and JScript Dictionary are both associative Arrays

obj = new Object ;
dic = new ActiveXObject("Scripting.Dictionary") ;

My question is... Is there any difference between them in terms of efficiency (either space or time) ??
In terms of functionality, I know a Dictionary is better because it allows more than just scalar types as keys. But putting that aside, which one is better/faster?

EDIT:
This is for Windows scripting, not for web development.

EDIT2:
I'm particularly interested in the lookup efficiency, since I'll need to work with big collections.

Was it helpful?

Solution

It appears from this document that the lookup is quicker using Dictionary; however the inserts are slower.

http://www.4guysfromrolla.com/webtech/100800-1.2.shtml

OTHER TIPS

Scripting.Dictionary is a COM/ActiveX component (can be used in any of MS scripting languages).

I wouldn't recommend it because every time you access it, you're calling into the COM component, which is very slow.

But if you need its functionality, you can use it, but beware that it only works in IE...

Javascript objects are inherent in the execution engine; Scripting.Dictionary is a COM object doing interop calls on every operation.

For anything in javascript, I would tend to prefer using the in-engine type unless I had a tremendous need for a lookup based on some other COM object with good equality semantics...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top