-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.js
51 lines (44 loc) · 1.33 KB
/
test.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
var qconf = require('node-qconf');
console.log('version:', qconf.version())
console.log('getConf:', qconf.getConf('/demo'))
console.log('getBatchKeys:', qconf.getBatchKeys('/backend', 'test'))
console.log('getBatchConf:', qconf.getBatchConf('/backend/umem/users'))
console.log('getAllHost:', qconf.getAllHost('/backend/umem/users'))
console.log('getHost:', qconf.getHost('/backend/umem/users'))
console.log('')
console.log('')
var i
var N = 100000
var t0
var t1
console.log("Performance test:")
t0 = (new Date()).getTime()
for (i = 0; i < N; i++) {
qconf.getConf('/demo')
}
t1 = (new Date()).getTime()
console.log('getConf:', (t1 - t0) / N, 'ms/op')
t0 = (new Date()).getTime()
for (i = 0; i < N; i++) {
qconf.getBatchKeys('/backend', 'test')
}
t1 = (new Date()).getTime()
console.log('getBatchKeys:', (t1 - t0) / N, 'ms/op')
t0 = (new Date()).getTime()
for (i = 0; i < N; i++) {
qconf.getBatchConf('/backend/umem/users')
}
t1 = (new Date()).getTime()
console.log('getBatchConf:', (t1 - t0) / N, 'ms/op')
t0 = (new Date()).getTime()
for (i = 0; i < N; i++) {
qconf.getAllHost('/backend/umem/users')
}
t1 = (new Date()).getTime()
console.log('getAllHost:', (t1 - t0) / N, 'ms/op')
t0 = (new Date()).getTime()
for (i = 0; i < N; i++) {
qconf.getHost('/backend/umem/users')
}
t1 = (new Date()).getTime()
console.log('getHost:', (t1 - t0) / N, 'ms/op')