szilanor / stream Goto Github PK
View Code? Open in Web Editor NEWTypesafe API for processing iterable data in TypeScript and JavaScript.
Home Page: https://szilanor.github.io/stream/
License: Apache License 2.0
Typesafe API for processing iterable data in TypeScript and JavaScript.
Home Page: https://szilanor.github.io/stream/
License: Apache License 2.0
The examples used for "Classical JS" seems to use code that is very slow and contains extensive typing and unneeded code.
As an example, here's a benchmark using the second to last code example (concerning readability):
Map x 636 ops/sec ±124.98% (5 runs sampled)
Stream x 30,502 ops/sec ±15.18% (37 runs sampled)
Object x 441,113 ops/sec ±19.31% (34 runs sampled)
Reduce x 1,285,775 ops/sec ±5.84% (43 runs sampled)
Object with For Loop x 443,450 ops/sec ±13.82% (43 runs sampled)
Fastest is Reduce
As it can be seen, the map from the example is very very slow. Using an object instead of map greatly improves performance and outperforms this library (as also indicated in #2 )
In terms of readability I'd like to suggest a more "cleaned up" comparison with less extensive typing and removing unneeded code so users can have a fair comparison between this library and "Classic JS". See following TS Playground as an example with different approaches to the problem from the example.
When using the provided benchmark, I noticed that I could not reproduce the stated result. In my tests, this library always was the slowest.
The results of my benchmark (I added a For Loop as comparison):
Classic JS x 11,375,579 ops/sec ±10.54% (48 runs sampled)
Stream API x 33,607 ops/sec ±25.26% (40 runs sampled)
For loop x 34,567,827 ops/sec ±91.45% (48 runs sampled)
Fastest is For loop
Did I maybe do something wrong in my setup? If not, I think it'd be good to either remove the benchmark or update them.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.