unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Yoni Rabkin <yoni@rabkins.net>
Cc: emacs-devel@gnu.org
Subject: Re: [elpa] externals/emms e9fa4c095d: * emms.el: reverse the order players are collected
Date: Tue, 06 Sep 2022 21:50:40 -0400	[thread overview]
Message-ID: <jwv7d2gosxr.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20220906220156.5255DC0088A@vcs2.savannah.gnu.org> (ELPA Syncer's message of "Tue,  6 Sep 2022 18:01:56 -0400 (EDT)")

> --- a/emms.el
> +++ b/emms.el
> @@ -1511,7 +1511,7 @@ If the track can be played by more than one player, call
>      (mapc
>       #'(lambda (player)
>  	 (when (funcall (emms-player-get player 'playablep) track)
> -	   (push player players)))
> +	   (setq players (append players `(,player)))))
>       emms-player-list)
>      (if (< 1 (length players))
>  	(emms-players-preference track players)

This changes the code's complexity from O(N) to O(N²) in the number of
players.  Maybe it's not a very big deal, but the standard way to avoid
this is to use `push` inside the loop followed by `nreverse` at the of
the loop.


        Stefan




       reply	other threads:[~2022-09-07  1:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <166250171605.12534.6807904164286037648@vcs2.savannah.gnu.org>
     [not found] ` <20220906220156.5255DC0088A@vcs2.savannah.gnu.org>
2022-09-07  1:50   ` Stefan Monnier [this message]
2022-09-07 20:16     ` [elpa] externals/emms e9fa4c095d: * emms.el: reverse the order players are collected Yoni Rabkin
2022-09-07 20:26       ` Stefan Monnier
2022-09-08  4:26         ` tomas

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwv7d2gosxr.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=yoni@rabkins.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).