Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move array mixin methods into CoreMongooseArray #7798

Closed
vkarpov15 opened this issue May 13, 2019 · 1 comment
Closed

Move array mixin methods into CoreMongooseArray #7798

vkarpov15 opened this issue May 13, 2019 · 1 comment
Milestone

Comments

@vkarpov15
Copy link
Collaborator

No description provided.

@vkarpov15
Copy link
Collaborator Author

Basic benchmark:

'use strict';

const Benchmark = require('benchmark');
const mongoose4 = require('mongoose');
// Note this is not the actual mongoose 5 npm module, this is just
// a symlinked alias for the purposes of this benchmark
const mongoose5 = require('mongoose-56');

const suite = new Benchmark.Suite;

const M4 = mongoose4.model('Test', new mongoose4.Schema({ arr: [String] }));
const M5 = mongoose5.model('Test', new mongoose5.Schema({ arr: [String] }));

suite.
  add('mongoose4', function() {
    new M4({ arr: ['foo', 'bar', 'baz'] });
  }).
  add('mongoose5', function() {
    new M5({ arr: ['foo', 'bar', 'baz'] });
  }).
  on('cycle', function(event) {
    console.log(String(event.target));
  }).
  on('complete', function() {
    console.log('Fastest is ' + this.filter('fastest').map('name'));
  }).
  run();

Output:

$ node queryperf.js 
mongoose4 x 79,094 ops/sec ±0.81% (89 runs sampled)
mongoose5 x 107,371 ops/sec ±0.98% (89 runs sampled)
Fastest is mongoose5
$ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants