Skip to content

Instantly share code, notes, and snippets.

@veered
Created May 14, 2018 22:43
Show Gist options
  • Save veered/931624389163916ded3a4f5617b558d1 to your computer and use it in GitHub Desktop.
Save veered/931624389163916ded3a4f5617b558d1 to your computer and use it in GitHub Desktop.
Reproduce _.isEmpty slowness
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
Widgets = new Mongo.Collection('widgets');
if (Widgets.find().count() < 1000) {
for (let i=0; i < 1000; i++) {
Widgets.insert({});
}
}
let handles = [];
for (let i=0; i<5000; i++) {
handles.push(Widgets.find({ i }).observe({ added(){}, changed(){}, removed(){} }));
}
import Profile from 'meteor/qualia:profile';
Profile.profileDuration('zprofile', '/Users/lucas/Downloads/zprofile.cpuprofile', 5000);
handles.forEach(handle => handle.stop());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment