Vow: the fastest promises

    I want to bring to your attention the Vow library , which was written by my colleague Dmitry Filatov dfilatov .

    The library implements Promises / A + , works very fast and requires a small amount of memory. According to performance tests, it is far ahead of Q , but at the same time it retains an asynchronous manner of work.

    Working with the Vow is as easy as working with the Q . Of the shortcomings (compared to Q ), we can only highlight the lack of progress .

    Sample code using Vow :
    function readFile(filename, encoding) {
        var promise = Vow.promise();
        fs.readFile(filename, encoding, function(err, data) {
            if (err) return promise.reject(err);
            promise.fulfill(data);
        });
        return promise;
    }
    Vow.all([readFile('test1.txt', 'utf8'), readFile('test2.txt', 'utf8')]).then(function(results) {
        console.log(results.join('\n'));
    });
    

    A benchmark that reflects how Q is a slow library (testing the creation of sequential promises is tested):
    timeoperations per second
    Q54.891ms18
    When3.484ms287
    Vow1.158ms864

    Also, a library for working with the file system is implemented for Vow: vow-fs : https://github.com/dfilatov/vow-fs .

    NPM Package: vow
    Repository: https://github.com/dfilatov/jspromise

    Also popular now: