Get string distance for a pseudo fuzzy search
The code becomes 25% faster if we extract values not changed in the loops to variables, but of course it's observable only on large number of repetitions or long strings as tested in Chrome.

function getEditDistance(a, b) {
    var lenA = a.length, lenB = b.length;
    if (lenA == 0) return lenB;
    if (lenB == 0) return lenA;

    var matrix = [];
    var i;
    for (i = 0; i &lt;= lenB; i++) {
        matrix[i] = [i];
    }

    var j, m0 = matrix[0];
    for (j = 0; j &lt;= lenA; j++) {
        m0[j] = j;
    }

    for (i = 1; i &lt;= lenB; i++) {
        var m = matrix[i], mPrev = matrix[i - 1];
        var bChar = b.charAt(i - 1);
        for (j = 1; j &lt;= lenA; j++) {
            if (bChar == a.charAt(j - 1)) {
                m[j] = mPrev[j - 1];
            } else {
                m[j] = Math.min(mPrev[j - 1] + 1, Math.min(m[j - 1] + 1, mPrev[j] + 1));
            }
        }
    }

    return matrix[lenB][lenA];
}


P.S. Replacing s.charAt(i) with s[i] provides no tangible speedup and is not cross-browser.