4 ms·
I ran up against this issue when I was creating a parser that parsed debian package information (code here[1]). Trying to match against a line with regex slowed
by djhaskin987 6y ago
I ran up against this issue when I was creating a parser that parsed debian package information (code here[1]). Trying to match against a line with regex slowed the program down past feasibility. I had to switch to just assuming that two line breaks meant a new package record instead. After that, the program was zippy.
1: https://github.com/djhaskin987/degasolv/blob/develop/cli-src/degasolv/pkgsys/apt.clj#L117 https://github.com/djhaskin987/degasolv/blob/develop/cli-src...
- tambre 6y agoDoes the control format have an official spec? I too have had to resort to parsing those files with regexes.
- djhaskin987 6y agoNot that I know of, but I have noticed that two newline characters separate package records, and the record is of the form `Key: Value` for each line. As you can see in my code, I've gotten rid of most/all of the regex stuff, because, as we observe, it kills performance.
- JdeBP 6y agoIt's chapter 5 of the Debian Policy Manual.