emacs-devel
[Top][All Lists]
Advanced

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

Re: Add a function for building sort predicates


From: Michael Heerdegen
Subject: Re: Add a function for building sort predicates
Date: Thu, 01 Feb 2024 20:22:01 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Daniel Mendler <mail@daniel-mendler.de> writes:

> Did you perform some measurements, comparing with the hand-written
> predicate in package.el?  The code does not look efficient with the
> function calls and the throws.

My version was around 6% slower. Using dynamic lookup of the key order.
I did not try with native compiling.

> In contrast, if the macro creates a sequence of conditions the native
> compiler can optimize the result. It all depends on the use case. If
> the rules are supposed to be customizable and the lists are short, the
> dynamic approach will likely work well enough. For long lists an
> efficient sort predicate makes a difference in my experience, e.g., in
> a dynamically updating completion UI with thousands of candidates,
> since the predicate is called very often.

A disadvantage is that custom option will have to introduce new :set
dependencies, I wanted to avoid that.

But in some cases the speed difference might be worth such an
optimization.  If you want to experiment, please be my guest.

Michael.



reply via email to

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