JavaScript performance optimization security