-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improving levenshtein performance. Refs #84
- Loading branch information
1 parent
03dce23
commit 2182a27
Showing
5 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
node_modules | ||
experiments | ||
benchmark | ||
.gitignore | ||
.npmignore | ||
*.yml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require('babel-core/register'); | ||
|
||
var levenshtein = require('../src/metrics/distance/levenshtein'); | ||
var leven = require('leven'); | ||
|
||
function run(fn) { | ||
fn('a', 'b'); | ||
fn('ab', 'ac'); | ||
fn('ac', 'bc'); | ||
fn('abc', 'axc'); | ||
fn('kitten', 'sitting'); | ||
fn('xabxcdxxefxgx', '1ab2cd34ef5g6'); | ||
fn('cat', 'cow'); | ||
fn('xabxcdxxefxgx', 'abcdefg'); | ||
fn('javawasneat', 'scalaisgreat'); | ||
fn('example', 'samples'); | ||
fn('sturgeon', 'urgently'); | ||
fn('levenshtein', 'frankenstein'); | ||
fn('distance', 'difference'); | ||
fn('abcde', 'tes'); | ||
fn('因為我是中國人所以我會說中文', '因為我是英國人所以我會說英文'); | ||
} | ||
|
||
suite('Levenshtein', function() { | ||
bench('talisman', function() { | ||
run(levenshtein); | ||
}); | ||
|
||
bench('leven', function() { | ||
run(leven); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters