[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] psvn: Speed up O(m+n^2) to O(m+n) in svn-status-marked-files of psvn.

From: Stefan Reichör <stefan_at_xsteve.at>
Date: 2005-08-04 22:34:17 CEST

Kalle Olavi Niemitalo <kon@iki.fi> writes:

> This patch is for r15394, I don't know if it still applies.
> This change is somewhat frivolous and I am not sure it should
> be committed.
>
>
> [[[
> Speed up O(m+n^2) to O(m+n) in svn-status-marked-files of psvn.
>
> * contrib/client-side/psvn/psvn.el
> (svn-status-marked-files): Use (loop ... collect ...) instead of
> append, thus avoiding quadratic complexity. I don't think this
> ever was too slow, but the new code is shorter too.
> ]]]
>
> --- psvn.el (revision 15394 variant kon.4.freevar)
> +++ psvn.el (revision 15394 variant kon.5.complexity)
> @@ -2065,12 +2065,9 @@ (defun svn-status-find-info-for-file-nam
> (defun svn-status-marked-files ()
> "Return all files marked by `svn-status-set-user-mark',
> or (if no files were marked) the file under point."
> - (let* ((st-info svn-status-info)
> - (file-list))
> - (while st-info
> - (when (svn-status-line-info->has-usermark (car st-info))
> - (setq file-list (append file-list (list (car st-info)))))
> - (setq st-info (cdr st-info)))
> + (let ((file-list (loop for file in svn-status-info
> + when (svn-status-line-info->has-usermark file)
> + collect file)))
> (or file-list
> (if (svn-status-get-line-information)
> (list (svn-status-get-line-information))

The loop macro looks nice. I have never used it before. And AFAIK the
cl stuff is not wide spread used in emacs community.
Furthermore I also don't think, that this function was ever too slow.

So I wouldn't commit that change.

Stefan.

P.S.: I will look at your other posted patches also. But that may take
some time. So please be patient.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Aug 4 23:24:55 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.