Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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