Craig.
dunbarx wrote: ↑Wed Apr 16, 2025 4:51 pm
61 ticks vs. 738 ticks. Did I compare the two methods, a loop and a regex-based "filter" method fairly? If so, the loop is 12 times faster. I would have thought the opposite, and to boot, the loop is a "repeat with..." type.
I'm afraid you've made an error in your script
your code says:
if "StringX" is in line y of tempVar then put y & comma after accum
It should be:
if "StringX" is in line y of temp then put y & comma after accum
You code starts querying
tempVar which only has 7 lines - all other instructions are ignored past that point. Since there is no line 8, 9, 10, etc in tempVar it just skips swiftly to the next iteration which is the reason it takes a whopping 61 ticks for the 7 lines.
In my testing, the Filter method (which is
not regex btw) takes 11 seconds to search the 7 million lines. Yes you get a beach ball for a few seconds (I presume this is the conversion of string to array), but it is
vastly quicker than the loop.
After correcting your loop, I interrupted the loop method after a few minutes as I got bored... the "y" counter variable had only reached 449,249.
I later tried again and let it run while I was watching stand up comedy on Netflix and after about 30 mins the counter had only reached about 1.5 million of the 7 million lines.
I'm afraid as yet I've not had the patience to wait for your method to finish searching the 7 million lines, so I'll stick with arrays and filter personally
Stam