js? What is its logical structure and physical structure?
js? What is its logical structure and physical structure?
first of all, Object is defined by ES, and ES does not specify what underlying data structure you need to use, so there is no solution to this problem.
I assume that what you want to ask is what V8 does for Object and what data structure it corresponds to. Let's move on.
Object is a castrated version of the hash table, which is explained below.
Let's first look at the definition of the hash table.
< H2 > hash table < / H2 >hash table ( Hash table , also called hash table ) It is based on the key (Key) to directly access the data structure in the memory storage location . That is, it accesses the record by calculating a function about the key value and mapping the data of the desired query to a location in the table, which speeds up the search. This mapping function is called hash function , and the array in which records are stored is called hash table .
< H2 > my explanation < / H2 >so Object corresponds to the castrated version of the hash table, which, better, should be Map, but Map is actually ordered, so update Java's SortedHashMap. The reason why Object is called castration means:
so he may have some problems. For example:
v8 src/base/hashmap.cc
use JavaScript to build a segment tree, and recursion is used in the construction process. This should make the call stack overflow. I wonder if there is any other way to solve this problem. < H1 > Code < H1 > ...