pmbootstrap-meow/pmb/parse
Caleb Connolly f186ee8498
parse: apkindex: optimise parser (MR 2252)
Rewrite the parser to be more efficient:
* Avoid using str.startswith()
* Simplify logic by parsing backwards and using lines.pop() rather than
  passing around an index.

Testing with "pmbootstrap test apkindex_parse_all" on my x86 laptop:

Before: Parsed 78537 packages from 7 APKINDEX files in 1.131 seconds
After : Parsed 78537 packages from 7 APKINDEX files in 0.609 seconds

That makes for an ~86% improvement, almost twice as fast.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:40 +02:00
..
__init__.py core: add an Arch type (MR 2252) 2024-06-23 12:38:39 +02:00
_apkbuild.py meta: introduce a Cache decorator (MR 2252) 2024-06-23 12:38:39 +02:00
apkindex.py parse: apkindex: optimise parser (MR 2252) 2024-06-23 12:38:40 +02:00
arguments.py commands: add pmbootstrap test (MR 2252) 2024-06-23 12:38:40 +02:00
binfmt_info.py treewide: adopt pathlib.Path and type hinting (MR 2252) 2024-06-23 12:38:37 +02:00
bootimg.py WIP: 2024-06-05: args hacking and more (MR 2252) 2024-06-23 12:38:38 +02:00
cpuinfo.py treewide: adopt pathlib.Path and type hinting (MR 2252) 2024-06-23 12:38:37 +02:00
depends.py chroot: apk: don't recurse depends (MR 2252) 2024-06-23 12:38:39 +02:00
deviceinfo.py meta: introduce a Cache decorator (MR 2252) 2024-06-23 12:38:39 +02:00
kconfig.py WIP: 2024-06-05: args hacking and more (MR 2252) 2024-06-23 12:38:38 +02:00
version.py treewide: adopt pathlib.Path and type hinting (MR 2252) 2024-06-23 12:38:37 +02:00