johnsmith153 — 2012-11-27T12:41:12-05:00 — #1
is very slow in JS.
I have tested this regular expression in the same code:
and it runs ultra quick, so it must be the regex, not the JS code.
Any ideas to speed it up?
parkint — 2012-11-27T13:30:00-05:00 — #2
Instead of making it Global can you refine the string that is being evaluated, to limit the amount of data?
Are you using the RegEx for a 'replacement' or just a 'match'?
What exactly are you trying to accomplish?
There may be a more efficient way to do it.
johnsmith153 — 2012-11-27T13:51:31-05:00 — #3
Thanks for replying.
My Regex is very poor and I put this together the best I can using various tutorials etc.
If anything looks stupid then it probably is.
It basically searches through a CSS file and returns an array of image URLs. That's all it needs to do. It doesn't need to to replace anything. It works, but takes ages to complete the processing.
jeff_mott — 2012-11-27T16:42:44-05:00 — #4
I've seen some very complicated regexps, and none of them were noticeably slow. If your code is running slowly, I strongly suspect it's for a different reason. If you post your whole code or a link to your page, we could do more to help you troubleshoot.