From e16777162019a138d5b4946a2015d30aec709dcc Mon Sep 17 00:00:00 2001 From: Revone Date: Fri, 8 Dec 2023 09:04:49 +0800 Subject: [PATCH] docs: Benchmarking metrics compared to native JavaScript --- CHANGELOG.md | 2 +- README.md | 126 +++++++++++++++++++++--------------------------- README_zh-CN.md | 70 ++++++++++----------------- package.json | 2 +- 4 files changed, 82 insertions(+), 118 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89840e9..b9bddf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 13fb309..c06a4da 100644 --- a/README.md +++ b/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`** - - - - - - - - - - - - - - - - - -
Test MethodsTime Taken (ms)
Queue push & shift5.83
Array push & shift2829.59
- -**`Deque vs. native Array, 100,000 scale`** - - - - - - - - - - - - - - - - - -
Test MethodsTime Taken (ms)
Deque unshift & shift2.44
Array unshift & shift4750.37
- -**`HashMap vs. native Map/Set, 100,000 scale`** - - - - - - - - - - - - - - - - - - - - - -
MethodTime Taken (ms)
HashMap 1,000,000 set122.51
Native Map 1,000,000 set223.80
Native Set 1,000,000 add185.06
- [//]: # (![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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MethodTime Taken (ms)Scale
Queue.push & shift5.83100,000
Native Array.push & shift2829.59100,000
Deque.unshift & shift2.44100,000
Native Array.unshift & shift4750.37100,000
HashMap.set 122.511,000,000
Native Map.set223.801,000,000
Native Set.add185.061,000,000
+ ## Installation and Usage Now you can use it in Node.js and browser environments diff --git a/README_zh-CN.md b/README_zh-CN.md index f5f4140..b8380b7 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -29,71 +29,53 @@ Heap, Binary Tree, RedBlack Tree, Linked List, Deque, Trie, Directed Graph, Undi ### 性能超越原生JS/TS -**`Queue和原生Array, 在100,000数据规模下性能对比`** - + + - + + - + + - -
Test MethodsMethod Time Taken (ms)Scale
Queue push & shiftQueue.push & shift 5.83100,000
Array push & shiftNative Array.push & shift 2829.59100,000
- -**`Deque和原生Array在100,000数据规模下的性能对比`** - - - - - - - - - - + + + - + + + + + + + + + + + + + + + + +
Test MethodsTime Taken (ms)
Deque unshift & shift
Deque.unshift & shift 2.44100,000
Array unshift & shiftNative Array.unshift & shift 4750.37100,000
HashMap.set 122.511,000,000
Native Map.set223.801,000,000
Native Set.add185.061,000,000
- -**`HashMap和原生Map/Set在100,000数据规模下的性能对比`** - - - - - - - - - - - - - - - - - - - - - -
MethodTime Taken (ms)
HashMap 1,000,000 set122.51
Native Map 1,000,000 set223.80
Native Set 1,000,000 add185.06
- [//]: # (![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)) diff --git a/package.json b/package.json index 20d2bfe..4e83ab5 100644 --- a/package.json +++ b/package.json @@ -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",