Permalink
Browse files

Add benchmark test

  • Loading branch information...
1 parent 49e7f67 commit 33ce89757d05222136b21b762492fd6f9323434e @geek geek committed Dec 2, 2015
Showing with 30 additions and 0 deletions.
  1. +28 −0 bench.js
  2. +2 −0 package.json
View
@@ -0,0 +1,28 @@
+'use strict'
+
+var Bench = require('bench')
+var Latest = require('seneca')
+var Local = require('./')
+
+var color = function () {
+ this.add('color:red', function (args, callback) {
+ callback(null, { hex: '#FF0000' })
+ })
+}
+
+Latest({ log: 'silent', transport: { port: 9998 } }).use(color).listen()
+var latestClient = Latest({ log: 'silent', transport: { port: 9998 } }).client()
+
+Local({ log: 'silent', transport: { port: 9999 } }).use(color).listen()
+var localClient = Local({ log: 'silent', transport: { port: 9999 } }).client()
+
+exports.compare = {
+ 'latest': function (done) {
+ latestClient.act('color:red', done)
+ },
+ 'local': function (done) {
+ localClient.act('color:red', done)
+ }
+}
+
+Bench.runMain()
View
@@ -82,6 +82,7 @@
},
"devDependencies": {
"async": "0.9.2",
+ "bench": "0.3.x",
"body-parser": "1.14.1",
"code": "1.5.0",
"connect": "3.4.0",
@@ -93,6 +94,7 @@
"joi": "6.x.x",
"lab": "6.2.0",
"no-shadow-relaxed": "1.0.1",
+ "seneca": "latest",
"seneca-echo": "0.3.0",
"seneca-error-test": "0.2.2"
}

0 comments on commit 33ce897

Please sign in to comment.