[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fix for bug 10994 breaks ido customizations in major way

From: Óscar Fuentes
Subject: Re: fix for bug 10994 breaks ido customizations in major way
Date: Sun, 05 May 2013 17:26:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

"Stephen J. Turnbull" <address@hidden> writes:

> Óscar Fuentes writes:
>  > So it seems that delete-dups is faster for strings than symbols.
> My interpretation is different: something is broken in the benchmarks
> (or in the estimate that the CPUs are of comparable performance).

I estimated that the CPUs are of similar performance because Leo reports
2 seconds for 10321 items and here it takes 12.5 seconds for 27000
items. Then items count ratio is 27000/10321 = 2.6, time ratio is 12.5/2
= 6.25 and the expected time ratio given O(n^2) complexity for the same
CPU is 2.6^2 = 6.76.


(let ((choices))
  (dotimes (i 10321)
    (push (make-symbol (format "s%d" i)) choices))
  (benchmark-run 10 (delete-dups choices)))

takes 6.26 seconds which is quite faster than the 19.9 seconds reported
by Leo. Maybe a L2 cache effect (2.4GHz Intel Q6600 with 4 MB L2 cache
for each pair of cores.)

> Comparing symbols for equality is a pointer comparison.  Comparing
> strings for equality is a pointer comparison, followed by more work
> (some variation on a memcmp) in case of failure.

Yep. A similar benchmark with strings instead of symbols:

(let ((choices))
  (dotimes (i 10321)
    (push (format "%d" i) choices))
  (benchmark-run 10 (delete-dups choices)))

takes 15.2 seconds, 1.5 per iteration.

Now, why delete-dups takes just 0.7 seconds for a list of strings a bit
*larger* than the one used above? The only difference is that those
strings follow the pattern directory/filename (it's the output of `git

However, the real issue being discussed here is if avoiding the overhead
of delete-dups on ido-completing-read warrants breaking some extensions
on a catastrophic way.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]