Skip to content

Commit

Permalink
docs: Benchmarking metrics compared to native JavaScript
Browse files Browse the repository at this point in the history
  • Loading branch information
zrwusa committed Dec 8, 2023
1 parent e167771 commit 7270a27
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 34 deletions.
39 changes: 24 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,50 +32,59 @@ 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>
<tr>
<td>Queue.push &amp; shift</td>
<td>5.83</td>
<td>100,000</td>
<td>data-structure-typed</td>
</tr>
<tr>
<td>Native Array.push &amp; shift</td>
<td>Array.push &amp; shift</td>
<td>2829.59</td>
<td>100,000</td>
<td>Native JS</td>
</tr>
<tr>
<tr>
<td>Deque.unshift &amp; shift</td>
<td>2.44</td>
<td>100,000</td>
<td>data-structure-typed</td>
</tr>
<tr>
<td>Native Array.unshift &amp; shift</td>
<td>Array.unshift &amp; 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>

Expand Down
45 changes: 27 additions & 18 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,50 +29,59 @@ 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>
<tr>
<td>Queue.push &amp; shift</td>
<td>5.83</td>
<td>100,000</td>
<td>data-structure-typed</td>
</tr>
<tr>
<td>Native Array.push &amp; shift</td>
<td>Array.push &amp; shift</td>
<td>2829.59</td>
<td>100,000</td>
<td>原生JS</td>
</tr>
<tr>
<tr>
<td>Deque.unshift &amp; shift</td>
<td>2.44</td>
<td>100,000</td>
<td>data-structure-typed</td>
</tr>
<tr>
<td>Native Array.unshift &amp; shift</td>
<td>Array.unshift &amp; 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>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 7270a27

Please sign in to comment.