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
a02a9a94d2
commit
e167771620
|
@ -8,7 +8,7 @@ All notable changes to this project will be documented in this file.
|
|||
- [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
||||
- [`auto-changelog`](https://github.com/CookPete/auto-changelog)
|
||||
|
||||
## [v1.48.6](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
|
||||
## [v1.48.7](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
|
||||
|
||||
### Changes
|
||||
|
||||
|
|
126
README.md
126
README.md
|
@ -17,78 +17,6 @@ Do you envy C++ with [STL]() (std::), Python with [collections](), and Java with
|
|||
anymore! JavaScript and TypeScript now have [data-structure-typed]().**`Benchmark`** compared with C++ STL. **`API standards`** aligned with ES6 and Java. **`Usability`** is comparable to Python
|
||||
|
||||
|
||||
|
||||
### We provide data structures that are not available in JS/TS
|
||||
|
||||
Heap, Binary Tree, RedBlack Tree, Linked List, Deque, Trie, Directed Graph, Undirected Graph, BST, AVL Tree, Priority Queue, Queue, Tree Multiset, Linked List.
|
||||
|
||||
|
||||
### Performance superior to native JS/TS
|
||||
|
||||
**`Queue vs. native Array, 100,000 scale`**
|
||||
<table style="display: table; width:100%; table-layout: fixed;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Test Methods</th>
|
||||
<th>Time Taken (ms)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Queue push & shift</td>
|
||||
<td>5.83</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Array push & shift</td>
|
||||
<td>2829.59</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
**`Deque vs. native Array, 100,000 scale`**
|
||||
<table style="display: table; width:100%; table-layout: fixed;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Test Methods</th>
|
||||
<th>Time Taken (ms)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Deque unshift & shift</td>
|
||||
<td>2.44</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Array unshift & shift</td>
|
||||
<td>4750.37</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
**`HashMap vs. native Map/Set, 100,000 scale`**
|
||||
<table style="display: table; width:100%; table-layout: fixed;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Method</th>
|
||||
<th>Time Taken (ms)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>HashMap 1,000,000 set</td>
|
||||
<td>122.51</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Map 1,000,000 set</td>
|
||||
<td>223.80</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Set 1,000,000 add</td>
|
||||
<td>185.06</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
[//]: # (![Branches](https://img.shields.io/badge/branches-55.47%25-red.svg?style=flat))
|
||||
|
||||
[//]: # (![Statements](https://img.shields.io/badge/statements-67%25-red.svg?style=flat))
|
||||
|
@ -97,6 +25,60 @@ Heap, Binary Tree, RedBlack Tree, Linked List, Deque, Trie, Directed Graph, Undi
|
|||
|
||||
[//]: # (![Lines](https://img.shields.io/badge/lines-68.6%25-red.svg?style=flat))
|
||||
|
||||
### We provide data structures that are not available in JS/TS
|
||||
|
||||
Heap, Binary Tree, RedBlack Tree, Linked List, Deque, Trie, Directed Graph, Undirected Graph, BST, AVL Tree, Priority Queue, Queue, Tree Multiset, Linked List.
|
||||
|
||||
|
||||
### 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>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Queue.push & shift</td>
|
||||
<td>5.83</td>
|
||||
<td>100,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Array.push & shift</td>
|
||||
<td>2829.59</td>
|
||||
<td>100,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Deque.unshift & shift</td>
|
||||
<td>2.44</td>
|
||||
<td>100,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Array.unshift & shift</td>
|
||||
<td>4750.37</td>
|
||||
<td>100,000</td>
|
||||
</tr>
|
||||
<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>1,000,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Set.add</td>
|
||||
<td>185.06</td>
|
||||
<td>1,000,000</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## Installation and Usage
|
||||
|
||||
Now you can use it in Node.js and browser environments
|
||||
|
|
|
@ -29,71 +29,53 @@ Heap, Binary Tree, RedBlack Tree, Linked List, Deque, Trie, Directed Graph, Undi
|
|||
|
||||
### 性能超越原生JS/TS
|
||||
|
||||
**`Queue和原生Array, 在100,000数据规模下性能对比`**
|
||||
<table style="display: table; width:100%; table-layout: fixed;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Test Methods</th>
|
||||
<th>Method</th>
|
||||
<th>Time Taken (ms)</th>
|
||||
<th>Scale</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Queue push & shift</td>
|
||||
<td>Queue.push & shift</td>
|
||||
<td>5.83</td>
|
||||
<td>100,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Array push & shift</td>
|
||||
<td>Native Array.push & shift</td>
|
||||
<td>2829.59</td>
|
||||
<td>100,000</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
**`Deque和原生Array在100,000数据规模下的性能对比`**
|
||||
<table style="display: table; width:100%; table-layout: fixed;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Test Methods</th>
|
||||
<th>Time Taken (ms)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Deque unshift & shift</td>
|
||||
<tr>
|
||||
<td>Deque.unshift & shift</td>
|
||||
<td>2.44</td>
|
||||
<td>100,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Array unshift & shift</td>
|
||||
<td>Native Array.unshift & shift</td>
|
||||
<td>4750.37</td>
|
||||
<td>100,000</td>
|
||||
</tr>
|
||||
<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>1,000,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Set.add</td>
|
||||
<td>185.06</td>
|
||||
<td>1,000,000</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
**`HashMap和原生Map/Set在100,000数据规模下的性能对比`**
|
||||
<table style="display: table; width:100%; table-layout: fixed;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Method</th>
|
||||
<th>Time Taken (ms)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>HashMap 1,000,000 set</td>
|
||||
<td>122.51</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Map 1,000,000 set</td>
|
||||
<td>223.80</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Native Set 1,000,000 add</td>
|
||||
<td>185.06</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
[//]: # (![Branches](https://img.shields.io/badge/branches-55.47%25-red.svg?style=flat))
|
||||
|
||||
[//]: # (![Statements](https://img.shields.io/badge/statements-67%25-red.svg?style=flat))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "data-structure-typed",
|
||||
"version": "1.48.6",
|
||||
"version": "1.48.7",
|
||||
"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