Giter Site home page Giter Site logo

zousan's People

Contributors

alubbe avatar bitespresso avatar bluejava avatar bryant1410 avatar maxnordlund avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zousan's Issues

Feature requests: Promisification and .finally

Hey Glenn,
thanks for exploring the options for a small, high performance Promise library!

Just to let you know, I think it would be very helpful to have some kind of a promisification handler because both in the front-end and back-end you will frequently have to promisify the standard library.

My second most favourite thing would be a .finally handler.

Are those something you could envision for this repo?

Source in ES Modules?

Thanks for your amazing lib in such a small size.
Any plan to provide an ES module form source?

The code is wrapped by UMD now. It's usable but forces to set the global name. And the AMD checking may also leads to some issues in special environment.

Since it's such a small library, including it in the upper application is useful. But the form now prevents tree-shaking etc.

I copy the source code into my project so far. Hope to use it as a dependency.

Better benchmarks

I found this jsperf benchmark, which I think is way too simple of a use case: http://jsperf.com/bluebird-vs-rsvp/89

So I added your library to the bluebird benchmark suite, which tests a set of small 1ms I/O operations instead of the synchronous .resolve(1).
To run them, just clone the repo, run npm install the main repo and the benchmark directory and run ./bench doxbee and ./bench parallel.

These are the result I am getting back - let me know what you think of these numbers:

Doxbee:
results for 10000 parallel executions, 1 ms per I/O op

file time(ms) memory(MB)
callbacks-baseline.js 227 43.60
promises-bluebird-generator.js 266 33.36
promises-bluebird.js 425 47.75
promises-cujojs-when.js 446 71.76
promises-tildeio-rsvp.js 520 66.28
promises-bluejava-zousan.js 551 71.25
callbacks-caolan-async-waterfall.js 692 76.12
promises-lvivski-davy.js 706 108.98
promises-dfilatov-vow.js 838 155.99
promises-calvinmetcalf-lie.js 858 165.59
generators-tj-co.js 1153 147.88
promises-ecmascript6-native.js 1288 176.08
promises-obvious-kew.js 1397 235.82
promises-then-promise.js 1650 217.07
promises-medikoo-deferred.js 1973 172.57
observables-Reactive-Extensions-RxJS.js 2895 287.86
promises-kode4food-welsh.js 3535 80.52
observables-pozadi-kefir.js 5909 189.24
observables-caolan-highland.js 6860 548.75
promises-kriskowal-q.js 8323 717.75
observables-baconjs-bacon.js.js 20751 846.07

Parallel:
results for 10000 parallel executions, 1 ms per I/O op

file time(ms) memory(MB)
promises-bluebird.js 491 106.86
promises-bluebird-generator.js 626 110.79
callbacks-baseline.js 670 42.71
promises-cujojs-when.js 950 164.30
promises-tildeio-rsvp.js 964 205.40
promises-bluejava-zousan.js 1050 212.48
callbacks-caolan-async-parallel.js 1248 214.15
promises-lvivski-davy.js 1702 267.55
promises-calvinmetcalf-lie.js 1844 354.80
promises-dfilatov-vow.js 2790 512.38
promises-ecmascript6-native.js 3227 519.22
promises-then-promise.js 3299 670.76
promises-kode4food-welsh.js 3725 210.52
promises-medikoo-deferred.js 3931 507.14
promises-obvious-kew.js 9455 960.55

Catch errors in the constructor

It doesn't seem to be part of Promises/A+, but browsers, bluebird, q and so on's promises do this. I would like Zousan to catch errors and reject the promise, too.

Considerable slowness on node environment in comparison to bluebird

Using this test code:

var Zousan = require('zousan');
var Bluebird = require('bluebird');

var bluebirds = [];
var zousans = [];

console.time('zousan');

for(var i = 0; i < 500000; i++) {
  zousans.push(new Zousan(function(resolve, reject) {
    resolve(1);
  }));
}

Zousan.all(zousans).then(() => {console.timeEnd('zousan')});

// ----------------------

console.time('bluebird');

for(var j = 0; j < 500000; j++) {
  bluebirds.push(new Bluebird(function(resolve, reject) {
    resolve(1);
  }));
}

Bluebird.all(bluebirds).then(() => {console.timeEnd('bluebird')});

And this environment:

[3/5.2]{1}niwi@kaleidos:~/tmp/speedtest> npm ls
/home/niwi/tmp/speedtest
├── [email protected]
└── [email protected]
[3/5.2]niwi@kaleidos:~/tmp/speedtest> node --version
v5.10.1

The results are:

[3/5.2]niwi@kaleidos:~/tmp/speedtest> node speedtest.js
zousan: 1112.415ms
bluebird: 440.596ms

Bug when

var a = new Zousan();
var b = new Zousan();
a.then(b.resolve, b.reject);
b.then(()=>console.log('hi'), ()=>console.log('bye'))

This doesn't work, it has something to do with call(_undefined, ...)

Publish v2.5.0 to NPM

First of all, thanks for your incredible library! I've tested it against more updated versions of Later, When, PinkySwear, BlueBird, etc, and Zousan is still the fastest by a large margin!

But the published version on NPM is the 2.3.3, not 2.5.0.

Thanks again!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.