📜 ⬆️ ⬇️

Vow: the fastest promises

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

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

Working with Vow looks as easy as working with Q. Among the shortcomings (compared to Q ), we can only single out 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 much Q is a slow library (creation of consecutive promises is being tested):
timeoperations per second
Q54.891ms18
When3.484ms287
Vow1.158ms864

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

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

Source: https://habr.com/ru/post/174339/


All Articles