mirror of
https://github.com/zrwusa/data-structure-typed.git
synced 2024-11-23 12:54:04 +00:00
docs: Benchmarking metrics compared to native JavaScript
This commit is contained in:
parent
e167771620
commit
7270a27425
39
README.md
39
README.md
|
@ -32,12 +32,14 @@ Heap, Binary Tree, RedBlack Tree, Linked List, Deque, Trie, Directed Graph, Undi
|
|||
|
||||
### Performance surpasses that of native JS/TS
|
||||
|
||||
|
||||
<table style="display: table; width:100%; table-layout: fixed;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Method</th>
|
||||
<th>Time Taken (ms)</th>
|
||||
<th>Scale</th>
|
||||
<th>Belongs To</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -45,37 +47,44 @@ Heap, Binary Tree, RedBlack Tree, Linked List, Deque, Trie, Directed Graph, Undi
|
|||
<td>Queue.push & shift</td>
|
||||
<td>5.83</td>
|
||||
<td>100,000</td>
|
||||
<td>data-structure-typed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Array.push & shift</td>
|
||||
<td>Array.push & shift</td>
|
||||
<td>2829.59</td>
|
||||
<td>100,000</td>
|
||||
<td>Native JS</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td>Deque.unshift & shift</td>
|
||||
<td>2.44</td>
|
||||
<td>100,000</td>
|
||||
<td>data-structure-typed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Array.unshift & shift</td>
|
||||
<td>Array.unshift & shift</td>
|
||||
<td>4750.37</td>
|
||||
<td>100,000</td>
|
||||
<td>Native JS</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HashMap.set </td>
|
||||
<td>122.51</td>
|
||||
<tr>
|
||||
<td>HashMap.set</td>
|
||||
<td>122.51</td>
|
||||
<td>1,000,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Map.set</td>
|
||||
<td>223.80</td>
|
||||
<td>data-structure-typed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Map.set</td>
|
||||
<td>223.80</td>
|
||||
<td>1,000,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Set.add</td>
|
||||
<td>185.06</td>
|
||||
<td>Native JS</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Set.add</td>
|
||||
<td>185.06</td>
|
||||
<td>1,000,000</td>
|
||||
</tr>
|
||||
<td>Native JS</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -29,12 +29,14 @@ Heap, Binary Tree, RedBlack Tree, Linked List, Deque, Trie, Directed Graph, Undi
|
|||
|
||||
### 性能超越原生JS/TS
|
||||
|
||||
|
||||
<table style="display: table; width:100%; table-layout: fixed;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Method</th>
|
||||
<th>Time Taken (ms)</th>
|
||||
<th>Scale</th>
|
||||
<th>方法名</th>
|
||||
<th>耗时(毫秒)</th>
|
||||
<th>数据规模</th>
|
||||
<th>所属标准库</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -42,37 +44,44 @@ Heap, Binary Tree, RedBlack Tree, Linked List, Deque, Trie, Directed Graph, Undi
|
|||
<td>Queue.push & shift</td>
|
||||
<td>5.83</td>
|
||||
<td>100,000</td>
|
||||
<td>data-structure-typed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Array.push & shift</td>
|
||||
<td>Array.push & shift</td>
|
||||
<td>2829.59</td>
|
||||
<td>100,000</td>
|
||||
<td>原生JS</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td>Deque.unshift & shift</td>
|
||||
<td>2.44</td>
|
||||
<td>100,000</td>
|
||||
<td>data-structure-typed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Array.unshift & shift</td>
|
||||
<td>Array.unshift & shift</td>
|
||||
<td>4750.37</td>
|
||||
<td>100,000</td>
|
||||
<td>原生JS</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HashMap.set </td>
|
||||
<td>122.51</td>
|
||||
<tr>
|
||||
<td>HashMap.set</td>
|
||||
<td>122.51</td>
|
||||
<td>1,000,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Map.set</td>
|
||||
<td>223.80</td>
|
||||
<td>data-structure-typed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Map.set</td>
|
||||
<td>223.80</td>
|
||||
<td>1,000,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Set.add</td>
|
||||
<td>185.06</td>
|
||||
<td>原生JS</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Set.add</td>
|
||||
<td>185.06</td>
|
||||
<td>1,000,000</td>
|
||||
</tr>
|
||||
<td>原生JS</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "data-structure-typed",
|
||||
"version": "1.48.7",
|
||||
"version": "1.48.8",
|
||||
"description": "Data Structures of Javascript & TypeScript. Heap, Binary Tree, Red Black Tree, Linked List, Deque, Trie, HashMap, Directed Graph, Undirected Graph, Binary Search Tree(BST), AVL Tree, Priority Queue, Graph, Queue, Tree Multiset, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue, Stack. Benchmark compared with C++ STL. API aligned with ES6 and Java.util. Usability is comparable to Python",
|
||||
"main": "dist/cjs/index.js",
|
||||
"module": "dist/mjs/index.js",
|
||||
|
|
Loading…
Reference in a new issue