admin管理员组文章数量:1391969
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.
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.
3 Answers
Reset to default 2It appears from this document that the lookup is quicker using Dictionary; however the inserts are slower.
https://web.archive/web/20181223064604/http://www.4guysfromrolla.:80/webtech/100800-1.2.shtml
Scripting.Dictionary is a COM/ActiveX ponent (can be used in any of MS scripting languages).
I wouldn't remend it because every time you access it, you're calling into the COM ponent, 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...
本文标签: scriptingJavascript Object vs JScript DictionaryStack Overflow
版权声明:本文标题:scripting - Javascript Object vs JScript Dictionary - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744592225a2614562.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论