Jakobo/inject — Issue #9: Pointcuts Performance from Regex
Author: Jakobo
Created: 2011-11-09 17:34:42+00:00
State: open

I've noticed some massive slowdown with the Pointcuts example. After digging through the code, the root of the issue is in scanning large libraries such as jQuery.

It seems to be rooted in the regex we're using when we scan for requires statements. The .replace + push method is not very effective and puts a lot of stuff into memory.

The proposal in commit 9cd921a0dee40ee0eafee3f69b5f3b37c852b515 addresses this by using a second regex for reducing the text down to blocks that are not the require() statements. Performance on this is much better and brings the pointcuts example on par with the other methods of inclusion.

Feedback is requested before I merge this down. Also, is there a cleaner way than the .replace() method for extracting require() matches?