On 5/23/20 1:02 PM, magic-gen...@damage.devloop.de wrote: > Hi, > the current e-file tool of app-portage/pfl is written in bash. e-file is > a CLI tool which searches portagefilelist.de for a given file and list > additional informations based on the local portage. Latter is done by > grep'ing through the ebuild files which is fast but IMHO not very smart. > > I rewrote e-file in python by using the portage API [1]. But loading the > API slows down the whole script. Is there any way to speed up my > implementation? Have I done something fundamentally wrong? > > Thanks in advance > Daniel > > [1] https://github.com/portagefilelist/client/blob/e-file-python/bin/e-file >
When I patched the portage API out of your script, I saw the run time drop from 4.2 seconds to 3.2 seconds with this patch: $ diff -U1 e-file.py.orig e-file.py --- e-file.py.orig 2020-05-23 13:16:26.873861849 -0700 +++ e-file.py 2020-05-23 13:16:42.076861548 -0700 @@ -6,3 +6,3 @@ import json -import portage +#import portage @@ -35,2 +35,3 @@ files = json.loads(r.text) +sys.exit(0) if len(files['result']) > 0: Are your results worse than mine? -- Thanks, Zac
signature.asc
Description: OpenPGP digital signature