forked from senecajs/seneca-transport
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbench.js
More file actions
30 lines (24 loc) · 940 Bytes
/
bench.js
File metadata and controls
30 lines (24 loc) · 940 Bytes
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
'use strict'
var Bench = require('bench')
var Seneca = require('seneca')
var Transport = require('./')
var color = function () {
this.add('color:red', function (args, callback) {
callback(null, { hex: '#FF0000' })
})
}
Seneca({ log: 'silent', default_plugins: { tranport: true }, transport: { port: 9998 } }).use(color).listen()
var publishedClient = Seneca({ log: 'silent', default_plugins: { tranport: true }, transport: { port: 9998 } })
.client()
Seneca({ log: 'silent', default_plugins: { tranport: false }, transport: { port: 9999 } }).use(color).use(Transport).listen()
var localClient = Seneca({ log: 'silent', default_plugins: { tranport: false }, transport: { port: 9999 } })
.use(Transport).client()
exports.compare = {
'published transport': function (done) {
publishedClient.act('color:red', done)
},
'local transport': function (done) {
localClient.act('color:red', done)
}
}
Bench.runMain()