One of the advantages of using transducers with RxJS is the performance improvement you can get from this, so far we have just commented on this improvement, now we will add some benchmarks so you can see the performance benefits for yourself. The results presented here are based on running on my personal computer; executions on different computers might lead to different results.
The most used and famous library for running benchmarks is called
benchmarks. We can install it to run in Node.js environments using
npm. To add it to your project just type the following command:
npm install [email protected]
Before we start to use the library to benchmark transducers, let's see how we can use it through an example. Let's compare the difference between calling a function to sum two numbers using
var Benchmark = require('benchmark') var suite = new Benchmark.Suite; var sum = (a,b)=>a+b; suite.add('Sum using call', function...