Skip to content

Instantly share code, notes, and snippets.

@ilyachenko
Created September 23, 2018 06:21
Show Gist options
  • Save ilyachenko/82be7d08c31f7968e220e1f0c7c7fa55 to your computer and use it in GitHub Desktop.
Save ilyachenko/82be7d08c31f7968e220e1f0c7c7fa55 to your computer and use it in GitHub Desktop.
RxJs vs native timeout
const timer$ = timer(1000);
timer$.subscribe(t => console.time('RxJs'))
timer$.subscribe(t => console.timeEnd('RxJs'));
setTimeout(() => console.time('setTimeout'), 1000);
setTimeout(() => console.timeEnd('setTimeout'), 1000);
// RxJs: 1.580078125ms
// setTimeout: 0.57373046875ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment