Gentoo Archives: gentoo-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-dev@l.g.o, magic-gentoo@××××××××××××××.de
Subject: Re: [gentoo-dev] speeding up usage of portage in e-file / portage file list
Date: Sat, 23 May 2020 20:20:39
Message-Id: 3f9cf082-8b05-729f-f8bd-8787ca3eeb31@gentoo.org
In Reply to: [gentoo-dev] speeding up usage of portage in e-file / portage file list by magic-gentoo@damage.devloop.de
1 On 5/23/20 1:02 PM, magic-gentoo@××××××××××××××.de wrote:
2 > Hi,
3 > the current e-file tool of app-portage/pfl is written in bash. e-file is
4 > a CLI tool which searches portagefilelist.de for a given file and list
5 > additional informations based on the local portage. Latter is done by
6 > grep'ing through the ebuild files which is fast but IMHO not very smart.
7 >
8 > I rewrote e-file in python by using the portage API [1]. But loading the
9 > API slows down the whole script. Is there any way to speed up my
10 > implementation? Have I done something fundamentally wrong?
11 >
12 > Thanks in advance
13 > Daniel
14 >
15 > [1] https://github.com/portagefilelist/client/blob/e-file-python/bin/e-file
16 >
17
18 When I patched the portage API out of your script, I saw the run time
19 drop from 4.2 seconds to 3.2 seconds with this patch:
20
21 $ diff -U1 e-file.py.orig e-file.py
22 --- e-file.py.orig 2020-05-23 13:16:26.873861849 -0700
23 +++ e-file.py 2020-05-23 13:16:42.076861548 -0700
24 @@ -6,3 +6,3 @@
25 import json
26 -import portage
27 +#import portage
28
29 @@ -35,2 +35,3 @@
30 files = json.loads(r.text)
31 +sys.exit(0)
32 if len(files['result']) > 0:
33
34 Are your results worse than mine?
35 --
36 Thanks,
37 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] speeding up usage of portage in e-file / portage file list magic-gentoo@××××××××××××××.de