javascript too slow