optimize string compare with hash code