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

Comments

@vkarpov15
Copy link
Collaborator

commented May 13, 2019

No description provided.

@vkarpov15 vkarpov15 added this to the 5.6 milestone May 13, 2019
vkarpov15 added a commit that referenced this issue May 21, 2019
vkarpov15 added a commit that referenced this issue May 21, 2019
@vkarpov15 vkarpov15 added the fixed? label May 22, 2019
@vkarpov15

This comment has been minimized.

Copy link
Collaborator Author

commented May 22, 2019

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
1 participant
You can’t perform that action at this time.