Oh, the coprodis_command function (line 5656) looks utterly brutal. From:
The regex while (true) loop has massive amounts of string manipulation. Very inefficient.
The regex would be a lot faster if it can be anchored to start (^) or end ($) (at least, that's what I learned in Perl long ago) that means line-by-line -- since it is processing instructions, line-by-line processing should be a lot faster. It would eliminate a lot of the string management stuff.
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.
Instruction names are string-matched, but I don't think those are heavily used. The main regex is still likely the biggest time sink.
Code:
https://github.com/raspberrypi/picotool/blob/master/main.cpp
The regex would be a lot faster if it can be anchored to start (^) or end ($) (at least, that's what I learned in Perl long ago) that means line-by-line -- since it is processing instructions, line-by-line processing should be a lot faster. It would eliminate a lot of the string management stuff.
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.
Instruction names are string-matched, but I don't think those are heavily used. The main regex is still likely the biggest time sink.
Statistics: Posted by katak255 — Mon Oct 28, 2024 6:17 am