I performed the Levenshtein distance function in Javascript, and I was wondering how long it would take to run it using the Wikedia example (Sunday and Saturday).
So I used console.time(), and console.timeEnd()to determine the time spent on this function.
for (var i = 0; i < 15; i++) {
console.time("benchmark" + i);
var result = LevenshteinDistance("sunday", "saturday");
console.timeEnd("benchmark" + i);
}
Since it ranged between 0.4 ms and 0.15 ms, I used a loop and I came across strange values:
- 0.187ms
- 0.028ms
- 0.022ms
- 0.022ms
- 0.052ms
- 0.026ms
- 0.028ms
- 0.245ms
- 0.030ms
- 0.024ms
- 0.020ms
- 0.019ms
- 0.059ms
- 0.039ms
- 0.040ms
A repeating thing is a high value for the first (and rarely the second) performance, and then lower values. (Same behavior between JS in Chrome console and NodeJS.)
, : "" Javascript ( JS V8)?
?