Which of the following code is better wrt performance?


#1
Posts = new Mongo.Collection("posts");

Posts.attachSchema(new SimpleSchema({
  title: {
    type: String
  }
}));

or

Posts = new Mongo.Collection("posts"); 
var Schemas = {};
Schemas.Post = new SimpleSchema({
  title: {
    type: String
  }
});  
Posts.attachSchema(Schemas.Post);

#2

If you’re asking which one has better write performance, it doesn’t matter. As for general performance, it wouldn’t matter either.

Also the last line of the second snippet should be:

Posts.attachSchema(Schemas.Post);

#3

Those are basically exactly the same, I think.