-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
78 lines (68 loc) · 1.74 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Error.stackTraceLimit = Infinity;
var parseArgs = require('minimist');
var args = parseArgs(process.argv);
const Profiler = require('./Profiler');
global.Gun = require('gun/gun');
require('gun-db');
//var vfs = require('sack.vfs' );
//var vol = vfs.Volume( "Mount", "data.vfs" );
//require('gun-file');
let getSmallNode = function() {
return {
one: 'one',
two: 'two',
three: 'three',
four: 'four',
five: 'five',
six: 'six',
seven: 'seven',
eight: 'eight',
nine: 'nine',
ten: 'ten'
};
}
let getMediumNode = function() {
let node = {};
let keyPrefix = "prop";
let val = "medium_property"
for (var i = 0; i < 1000; i++) {
node[`${keyPrefix}_${i}`] = val;
}
return node;
};
let getLargeNode = function() {
let node = {};
let keyPrefix = "prop";
let val = "large_property"
for (var i = 0; i < 10000; i++) {
node[`${keyPrefix}_${i}`] = val;
}
return node;
};
let runMedium = () => {
if (!args['skip-medium']) {
let medium = new Profiler("__ Medium Nodes: 1000 Properties Each __", getMediumNode(), 100);
medium.run(runLarge);
} else {
runLarge();
}
}
let runLarge = () => {
if (!args['skip-large']) {
let large = new Profiler("__ Large Nodes: 10000 Properties Each __", getLargeNode(), 10);
large.run(finished);
} else {
finished();
}
}
if (!args['skip-small']) {
let small = new Profiler("__ Small Nodes: 10 Properties Each __ ", getSmallNode(), 10000);
small.run(runMedium);
} else {
runMedium();
}
var finished = () => {
// anchor vol so it doesn't garbage collect
if( vol ) vol.Sqlite( "finshed.db" );
console.log( "done?" );
}