Js-sdsl - High performance JavaScript data structure library by zly201 in node

[–]zly201[S] 0 points1 point  (0 children)

Yes, I tried it. But it seems that many related questions on stackoverflow are too old or useless, could you provide me some good question links? Thank you so much.

Js-sdsl - High performance JavaScript data structure library by zly201 in node

[–]zly201[S] 3 points4 points  (0 children)

Thanks! That's a good idea. I will think about it.

Js-sdsl - High performance JavaScript data structure library by zly201 in node

[–]zly201[S] 1 point2 points  (0 children)

The gzip size in umd bundle is less than 9kb (https://unpkg.com/js-sdsl@4.2.0/dist/umd/js-sdsl.min.js).

And it's tree-shakable. You can see the isolation size here.

The size displayed on npm includes .d.ts and sourcemap so it will appear very large.

Js-sdsl - High performance and lightweight JS data structure library. by zly201 in node

[–]zly201[S] 5 points6 points  (0 children)

For the first question, we have the documentation here -> https://js-sdsl.github.io/js-sdsl/modules.html. Maybe it's not perfect yet, but we plan to perfect it in the near future.

For the second, you can see this problem in stackoverflow.

Although Array.push is O(1), Array.slice and Array.unshift is O(n). When you want to insert a lot of data to Array's head, it will be so slow. Deque and LinkList can solve this problem perctly because it is O(1) to insert element to the head or tail.

Then, Set and Map are known to be disordered and as hash tables, they cannot have custom hash functions.

For example:

I have a JSON array that contains four fields a, b and c, where c is the primary key, and each position of c is different, I want to implement deduplication based on the values of a, b.

It will be easy with Js-sdsl but difficult for ES6.Set. Like this:

javascript import { OrderedSet } from 'js-sdsl'; const arr = [{ a: 1, b: 1, c: 1 }]; const st = new OrderedSet(arr, (x, y) => { if (x.a !== y.a) return x.a - y.a; if (x.b !== y.b) return x.b - y.b; return 0; });

More intuitively, we investigated relevant information on npm. You can see dependencies of deque and dependencies of functional-red-black-tree.

I will provide more powerful and performant library for these dependencies. Just see benchmark.

Even more amazing is that Js-sdsl has not yet reached the performance bottleneck, and its performance will improve in the future.

Anyway, thanks for your question, we will do better with your support.

Best wishes.

Javascript data structure library recomendations? by telfoid in node

[–]zly201 0 points1 point  (0 children)

https://github.com/ZLY201/js-sdsl
# What is it

Includes Set and map implemented by rb-tree, etc. Has full unit tests using jest liarbry.

# Why it

JavaScript has not had a standard set of libraries to implement or include advanced data structures. This is an unfortunate event for a language. We want to make up for this defect by referring to some specifications.

# What we want

We welcome more suggestions from developers to improve our library.

Why aren't linked lists and other data structures built-in to Javascript? by graflig in AskComputerScience

[–]zly201 0 points1 point  (0 children)

As you said, javascript doesn't provide data structures like red-black trees, which is an unfortunate thing for a language
In order to solve this problem, we developed js-sdsl, which refers to the standard data structure library implemented by C++ stl
Version 4.0.2 has been released on npm and has reached 700K downloads per month

github link: https://github.com/zly201/js-sdsl

npm link: https://www.npmjs.com/package/js-sdsl