linkedin/inject — pull request #278 by Jakobo (2013-09-10 17:36:53+00:00)
Title: Performance changes to minimize LinkJS Impact

The LinkJS Library has lessened our maintenance burden in two key areas:

* Detecting parse errors during execution (in executor.js)
* Extracting dependencies (in analyzer.js)

@gvsboy posted to the internal mailing list that performance in 0.5.0 was down. This was especially noticeable with larger files. The culprit was determined to be the LinkJS source. The tokenizing / parsing is just too heavyweight for Inject.

This pull request pulls in a cleaner (documented) version of the regex items used back in 0.4.2, and cleans up the execution to be more readable. Additionally, LinkJS is only invoked during execution once the eval() enters the failed state via a try/catch block. The additional try/catch weight should be minimal, as it's invoked only during the error cases.