Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8037

MicroPython • Re: v1.24.0 released

$
0
0
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.
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 -

Code:

for sourceLine in file:  if ValidLine(sourceLine, regExString):    if ContainsMagicOpcode(sourceLine):      ...
A fast check for a magic opcode and only then checking if the line is valid should be much faster -

Code:

for sourceLine in file:  if ContainsMagicOpcode(sourceLine):    if ValidLine(sourceLine, regExString):      ...
In my version I do -

Code:

for sourceLine in file:  a = sourceLine.split()  if a[3] in magicOpcode:    ...
That seems to be fast enough.

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



Viewing all articles
Browse latest Browse all 8037

Trending Articles