Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added `make benchmark`

  • Loading branch information...
commit 6f5d1258f906e4ebe61571bc2d40189c7ac97fa5 1 parent bf41b18
@tj tj authored
Showing with 39 additions and 1 deletion.
  1. +1 −0  .gitignore
  2. +4 −1 Makefile
  3. +31 −0 benchmarks.js
  4. +3 −0  package.json
View
1  .gitignore
@@ -2,3 +2,4 @@
\#*
*.kpf
classifier.json
+node_modules
View
5 Makefile
@@ -18,5 +18,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
+benchmark:
+ @node benchmarks
+
clean:
- @rm -f **/*~ *~ **/\#* \#*
+ @rm -f **/*~ *~ **/\#* \#*
View
31 benchmarks.js
@@ -0,0 +1,31 @@
+
+/**
+ * Module dependencies.
+ */
+
+var uubench = require('uubench')
+ , natural = require('./')
+ , metaphone = natural.Metaphone.process;
+
+var suite = new uubench.Suite({
+ start: function(){
+ console.log();
+ },
+
+ result: function(name, stats){
+ var persec = 1000 / stats.elapsed
+ , ops = stats.iterations * persec;
+ console.log(' \033[90m%s : \033[36m%s \033[90mops/s\033[0m', name, ops | 0);
+ },
+
+ done: function(){
+ console.log();
+ }
+});
+
+suite.bench('metaphone()', function(next){
+ metaphone('stephen');
+ next();
+});
+
+suite.run();
View
3  package.json
@@ -5,6 +5,9 @@
"engines": {
"node": ">=0.2.6"
},
+ "devDependencies": {
+ "uubench": "0.0.x"
+ },
"author": "Chris Umbel <chris@chrisumbel.com>",
"keywords": ["natural", "language", "porter", "lancaster", "stemmer", "bayes",
"classifier", "phonetic", "metaphone", "inflector"],
Please sign in to comment.
Something went wrong with that request. Please try again.