Gentoo Archives: gentoo-portage-dev

From: Donnie Berkholz <spyderous@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] Manifest2 reloaded
Date: Thu, 16 Mar 2006 07:19:23
Message-Id: 4419103C.4070706@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] Manifest2 reloaded by Brian Harring
1 Brian Harring wrote:
2 > python -m timeit -s 's="asdf"*400;s+="fdsa.ebuild"' 's.endswith(".ebuild")'
3 > 1000000 loops, best of 3: 0.88 usec per loop
4
5 > python -m timeit -s 's="asdf"*400;s+="fdsa.ebuild"' 's[-7:] == ".ebuild"'
6 > 1000000 loops, best of 3: 0.564 usec per loop
7
8 > Use endswith
9
10 > oddly, worth noting that startswith differs in this behaviour...
11 > python -m timeit -s 's="asdf"*400;s+="fdsa.ebuild"' 's[:7] == ".ebuild"'
12 > 1000000 loops, best of 3: 0.592 usec per loop
13
14 > python -m timeit -s 's="asdf"*400;s+="fdsa.ebuild"' 's.startswith(".ebuild")'
15 > 1000000 loops, best of 3: 0.842 usec per loop
16
17 Um, those both read the same way to me. You just switched the ordering
18 around, so the (starts|ends)with is on the bottom instead of the top,
19 but both times (starts|ends)with is longer.
20
21 Thanks,
22 Donnie

Attachments

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

Replies

Subject Author
Re: [gentoo-portage-dev] [PATCH] Manifest2 reloaded Brian Harring <ferringb@×××××.com>