Yes, that seems to be the main issue. Not that I fully understand it but it looks to me like it's doing a less than optimal -If the regex can be simplified, a first-pass per-line basic match would go pretty fast, then we can do a second match to retrieve the individual elements.
Code:
for sourceLine in file: if ValidLine(sourceLine, regExString): if ContainsMagicOpcode(sourceLine): ...Code:
for sourceLine in file: if ContainsMagicOpcode(sourceLine): if ValidLine(sourceLine, regExString): ...Code:
for sourceLine in file: a = sourceLine.split() if a[3] in magicOpcode: ...So I am prepared to accept that 'RegEx' isn't necessarily slow - though it seems it can be using MSVC and could be improved as you suggest, but more that it is being applied too often.
I can understand why it is as I think it is, if it is, but I am of the opinion that it's just too slow as it is and one has to make compromises to make it usable in practice. 'Doing it properly' or 'doing it quickly' could be selected on size of source file or a command option.
Statistics: Posted by hippy — Mon Oct 28, 2024 1:16 pm