RunKit + npm: mingo

node v10.24.1
version: master
endpointsharetweet
var mingo = require("mingo") function makeid(length) { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for (var i = 0; i < length; i++) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; } const arrayToSort = []; for(var i = 0; i < 5000; i++){ arrayToSort.push(makeid(20)); } const mingoSorter1 = new mingo.Aggregator( [ { $sort: { number: 1 } } ], { collation: { locale: 'en', strength: 1 } } ); const mingoSorter2 = new mingo.Aggregator( [ { $sort: { number: 1 } } ] ); console.time('MINGO SORT WITH LOCALE'); const result1 = mingoSorter1.run(arrayToSort); console.timeEnd('MINGO SORT WITH LOCALE'); console.time('MINGO SORT WITHOUT LOCALE'); const result2 = mingoSorter2.run(arrayToSort); console.timeEnd('MINGO SORT WITHOUT LOCALE');
Created from: https://npm.runkit.com/mingo
Loading…

no comments

    sign in to comment