public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [PATCH] repoman: filter out duplicate dependencies in error messages
Date: Mon, 4 Jan 2016 21:36:00 -0800	[thread overview]
Message-ID: <568B5640.7040102@gentoo.org> (raw)
In-Reply-To: <1451943030-20380-1-git-send-email-vapier@gentoo.org>

On 01/04/2016 01:30 PM, Mike Frysinger wrote:
> +								# Filter out duplicates.  We do this by hand (rather
> +								# than use a set) so the order is stable and better
> +								# matches the order that's in the ebuild itself.
> +								atoms = []
> +								for atom in all_atoms:
> +									if atom not in atoms:
> +										atoms.append(atom)
> +

Alternative implementation using OrderedDict which has O(1) average
complexity for containment checks, rather than O(N):

    atoms = OrderedDict()
    for atom in all_atoms:
        atoms.setdefault(atom, atom)
    atoms = list(atoms)

-- 
Thanks,
Zac


      parent reply	other threads:[~2016-01-05  5:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04 21:30 [gentoo-portage-dev] [PATCH] repoman: filter out duplicate dependencies in error messages Mike Frysinger
2016-01-05  3:17 ` Brian Dolbec
2016-01-05  9:43   ` Brian Dolbec
2016-01-15 18:22   ` Mike Frysinger
2016-01-05  5:36 ` Zac Medico [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=568B5640.7040102@gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox