public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* Re: [gentoo-portage-dev] [PATCH] Manifest2 reloaded
  @ 2006-03-16  7:14 99%       ` Donnie Berkholz
  0 siblings, 0 replies; 1+ results
From: Donnie Berkholz @ 2006-03-16  7:14 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 833 bytes --]

Brian Harring wrote:
> python -m timeit -s 's="asdf"*400;s+="fdsa.ebuild"' 's.endswith(".ebuild")'
> 1000000 loops, best of 3: 0.88 usec per loop

> python -m timeit -s 's="asdf"*400;s+="fdsa.ebuild"' 's[-7:] == ".ebuild"'
> 1000000 loops, best of 3: 0.564 usec per loop

> Use endswith

> oddly, worth noting that startswith differs in this behaviour...
> python -m timeit -s 's="asdf"*400;s+="fdsa.ebuild"' 's[:7] == ".ebuild"'
> 1000000 loops, best of 3: 0.592 usec per loop

> python -m timeit -s 's="asdf"*400;s+="fdsa.ebuild"' 's.startswith(".ebuild")'
> 1000000 loops, best of 3: 0.842 usec per loop

Um, those both read the same way to me. You just switched the ordering
around, so the (starts|ends)with is on the bottom instead of the top,
but both times (starts|ends)with is longer.

Thanks,
Donnie


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2006-03-04  3:50     [gentoo-portage-dev] [PATCH] Manifest2 reloaded Marius Mauch
2006-03-15 23:44     ` Marius Mauch
2006-03-16  5:53       ` Zac Medico
2006-03-16  7:15         ` Brian Harring
2006-03-16  7:14 99%       ` Donnie Berkholz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox