Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Rxjs-Filter vs JS-If
(version: 1)
Comparing performance of:
Filter vs If
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/rxjs/7.8.1/rxjs.umd.min.js'></script>
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); }
Tests:
Filter
const stream = new rxjs.Subject(); stream.pipe( rxjs.operators.filter(v => v) ).subscribe(v => { console.log(v); }); stream.next(true); stream.next(false); stream.next(true);
If
const stream = new rxjs.Subject(); stream.subscribe(v => { if(v) { console.log(v); } }); stream.next(true); stream.next(false); stream.next(true);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Filter
If
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0
Browser/OS:
Firefox 134 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Filter
98475.6 Ops/sec
If
107094.7 Ops/sec
Related benchmarks:
RxJs vs Array
RxJs vs Array - fixed2
RxJS filter vs if
RxJs vs Array v7.5.4
RXJS - simple if vs filter
Rxjs several pipes vs one 100k without functional array functions at all
Rxjs several pipes vs one 100k without functional array functions at all 123sdfaasd
fromEvent vs addEventListener
Assigning new variable
Comments
Confirm delete:
Do you really want to delete benchmark?