Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save samal-rasmussen/910ef2238eb5ea81fdca8eeba4ae29d1 to your computer and use it in GitHub Desktop.
Save samal-rasmussen/910ef2238eb5ea81fdca8eeba4ae29d1 to your computer and use it in GitHub Desktop.
Simple Rxjs subject load tester
const subjectCount = 500000;
const subjects = [];
for(let i = 0 ; i < subjectCount; i++) {
subjects[i] = new Subject();
subjects[i].subscribe(
(next) => console.log('next ' + i + ' ' + next),
(error) => console.log('error ' + i + ' ' + error),
() => console.log('close ' + i)
);
}
let count = 0;
setInterval(
() => {
subjects[Math.floor(Math.random() * subjectCount)].next(count++);
},
10
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment