denisT
@denist
New Member
Joined: Feb 14, 2024
Topics: 218 / Replies: 11426
Reply
RE: Fast search through text file

( t0 = timestamp() h0 = heapfree ss = filterstring strToCheck “\n” pt = “kappa*” ii = for k=1 to ss.count where matchpattern (trimleft ss[k] ” \t”)…

2 years ago
Forum
Reply
RE: Fast search through text file

so is it not as simple as: ( t0 = timestamp() h0 = heapfree ss = filterstring strToCheck “\n” rx = dotnetobject “System.Text.RegularExpressions.Re…

2 years ago
Forum
Reply
RE: Fast search through text file

Serejah: python is order of magnitude slower for this expression @”(^|\n|\r)\s*kappa” which matches lines starting with kappa oops… I seem to ha…

2 years ago
Forum
Reply
RE: Fast search through text file

could you post (or send me) the file you are using for the test? (SampleText.txt) to measure performance we have to test the same source

2 years ago
Forum
Reply
RE: Fast search through text file

I don’t see any reason to use Python… I’m pretty sure C# (dotnet) can do it just as fast.

2 years ago
Forum
Reply
RE: Fast search through text file

ok… found… next(iterator, default) Retrieve the next item from the iterator by calling its next() method. If default is given, it is returned if the i…

2 years ago
Forum
Reply
RE: Fast search through text file

I don’t know how to suppress “StopIteration” yielding yet… it needs some “wrapping” of python try/except.

2 years ago
Forum
Reply
RE: Fast search through text file

something like this: ( t0 = timestamp() h0 = heapfree r = (re.finditer “\n” strToCheck) k = (re.finditer “kappa” strToCheck) y = 0 s = 0 i =…

2 years ago
Forum
Reply
RE: Fast search through text file

as I said above, it’s very easy to get… just find ends of all lines first

2 years ago
Forum
Reply
RE: Fast search through text file

the well-known issue kills performance – iterating of dotnet collections.

2 years ago
Forum
Reply
RE: Fast search through text file

the pure MXS dotnet is not bad too: ( t0 = timestamp() h0 = heapfree matches = (dotnetclass “System.Text.RegularExpressions.Regex”).Matches strToC…

2 years ago
Forum
Reply
RE: Fast search through text file

Serejah: compared to a wall of text needed for c# python is definitely a winner maybe (and very likely) we might have a memory issue with python…

2 years ago
Forum
Reply
RE: Fast search through text file

it might be a smarter way, but I use the first that comes to mind: cmd = python.import “__builtin__” cmd.list k as array

2 years ago
Forum
Reply
RE: Fast search through text file

re = python.import “re” ( t0 = timestamp() h0 = heapfree n = (re.finditer “\n” strToCheck) k = (re.finditer “kappa” strToCheck) o = (re.finditer “…

2 years ago
Forum
Reply
RE: Fast search through text file

I’m pretty sure finding all occurrences is very fast if you only get the position. so I would first find all the positions of the end of the lines and…

2 years ago
Forum
Page 9 / 777