Try to minimize the window
while ( hash_str [ str . charAt ( start ) . charCodeAt ( 0 ) ] > hash_pat [ str . charAt ( start ) . charCodeAt ( 0 ) ] || hash_pat [ str . charAt ( start ) . charCodeAt ( 0 ) ] == 0 ) { if ( hash_str [ str . charAt ( start ) . charCodeAt ( 0 ) ] > hash_pat [ str . charAt ( start ) . charCodeAt ( 0 ) ] ) hash_str [ str . charAt ( start ) . charCodeAt ( 0 ) ] -- ; start ++ ; }