Xsecrets wrote:
oh boy I can see this one getting severely abused.
With great power comes great responsibility
Xsecrets wrote:
what kind of performance improvements?
1. I had a few too many str_replace functions on the same string multiple times. Now I changed it to do it in one place
2. The initial search check was searching each line for a match. So if there are 1000 lines in a file, and the change is on line 900, the initial search would scan the file for the first match... which happens at 900.. Then that was being used more like a boolean. I wasn't returning that line number so the real modify function would start over scanning again at line 1. But since the initial search was at line 900, I know that is where the first match is, so I pass that line number back into the modify function. So now it just starts at the exact same line to do the change. So thats 899 less lines to scan. So it theoretically is a big performance improvement for mods of larger source files that had the changes towards the end of the file.