Javascript Object vs JScript Dictionary

Javascript and JScript Dictionary objects are associative arrays

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

My question is ... Is there a difference between the two in terms of efficiency (either space or time) ??
As for functionality, I know that a dictionary is better, because it allows you to use not only scalar types, but also keys. But putting that aside, which one is better / faster?

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

EDIT2:
I am particularly interested in search efficiency, since I need to work with large collections.

+4
source share
3 answers

This document shows that searches are faster with the help of a dictionary; however inserts are slower.

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

+2
source

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

I would not recommend it, because every time you access it, you call the COM component, which is very slow.

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

+2
source

Javascript objects are inherent in the execution engine; Scripting.Dictionary is a COM object that makes interop calls for each operation.

Anything in javascript, I'd rather use a type in the engine if I didn't have a huge need for a search based on some other COM object with good equality semantics ...

+2
source

Source: https://habr.com/ru/post/1285748/


All Articles