Serejah
@serejah
New Member
Joined: Feb 14, 2024
Topics: 34 / Replies: 1221
Reply
RE: Fast search through text file

Dictionary actually beats the regex version and manual extraction of the first word improves perfomance even more ~65ms Perhaps there’s no reason to …

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

this one is pure python and it completes in a ~250ms on my ancient laptop. But hell knows how to pass the data to mxs import time import re words = …

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

don’t need to use so many variables, just use Dictionary with string key and integer value then simply check if the dictionary has the key (first word…

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

the only trouble I see is that not every match might be valid since “kappa*” pattern will match “kappa ” exactly as “kappaz”, that’s why I dismissed s…

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

miauu: You can see what the script has to do – find each line of the strToCheck which starts with one of predefined words and collect some data. …

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

ok, I see. python is order of magnitude slower for this expression @”(^|\n|\r)\s*kappa” which matches lines starting with kappa guess we have to writ…

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

denisT: after that it’s quick and easy to find the line of the substring. hmm… but it will require a linear search of the index that is larger th…

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

the regex syntax is pretty simple, still I’d suggest you to read some good book about how to write efficient expressions. It will make your life easie…

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

compared to a wall of text needed for c# python is definitely a winner

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

looks very promising. how do you convert these iterators to a mxs array?

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

ok, managed to test the code in max and it turns out issue with zero matches was with the regex patterns required another couple of slashes for word b…

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

did you try the link I posted above? It worked well and lists weren’t empty yes, you can print to the listener, but you’ll have to add autodesk.max.d…

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

if the input data is the same in both cases then it is something with the c# code

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

miauu: Can this version work if I sent a string, not a txt file? The one I posted? Yes, it works only for strings. If you want to read the text f…

2 years ago
Forum
Reply
RE: "Pointer" to an array/variable?

if I’’m not mistaken this should print 42 ( a = #(1,2,3) ref = &a a = #(42) format “%\n” (*ref) )

2 years ago
Forum
Page 4 / 84