Ticket #2389 (closed feature: fixed)
_getScriptLocation appears to be a performance bottleneck
|Reported by:||tmcw||Owned by:|
Hi, I've started doing a bit of profiling of the OpenLayers code and it appears that _getScriptLocation in lib/OpenLayers/Util.js is something of a low-hanging fruit. Every time that it's called, it creates and runs a regular expression over every script element found in the document's header. Except in the most extreme of extreme cases, the value it returns will not change, but in the current implementation it is not cached, and it is called quite a few times - enough that it's at the top of the time taken by OpenLayers. It seems like a simple fix would be to store the value of _getScriptLocation in the window element and check for its existence before running the logic again.