unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Dmitry Gutov <dgutov@yandex.ru>,
	Stefan Kangas <stefan@marxist.se>, Eli Zaretskii <eliz@gnu.org>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: [External] : Re: Lift {global,local}-key-binding to Lisp
Date: Thu, 21 Jan 2021 18:16:32 +0000	[thread overview]
Message-ID: <SA2PR10MB4474AC8FDBDC3624A24D689BF3A19@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
In-Reply-To: <684c8177-4c7f-e678-7587-6a1250af53f7@yandex.ru>

> The recent `length-<' etc. additions come to mind...
> 
> Not sure this is a good example.
> 
> length-< needs to be as fast as length to be generally useful.

The _point_ of adding those functions was to not
pay a performance penalty with a long list, just
to compare its length with some number.  IOW,
short-circuit traversing the _entire_ list, as
soon as the comparison question can be answered.
Like using `or' or `and': test only as much as
you need.

That's the _only_ performance that matters here;
it's the reason that everyone got excited about
creating these predicates.

The case for such a comparison where the entire
list actually has to be traversed is essentially
a corner case.  That was not the point of adding
these predicates.

Besides that, no info was presented on just how
much faster a C traversal of an entire list is.

Is that (unpresented) additional speed, for an
entire traversal, actually needed?  How so?

Or was the eagerness to do this in C only that:
an eagerness to do it in C?

___

Beyond that, the Lisp definitions (I provided)
are superior, in that (1) they are consistent
(not sometimes raising an error and sometimes
not, for the same predicate sexp) and (2) they
work also for dotted lists (and circular lists).

#2 means you don't have to also check a list
first, to ensure that it's a proper list before
making a comparison.  (And that extra check is
not free.)

And it means, obviously, that you get the added
benefit of being able to use the check on a
dotted list.  In Lisp, a "list" can be either
dotted or proper/true.  Both are used, and both
are useful.  If a length predicate is useful
for a proper list it can be just as useful for
a dotted list.

But Lars, who implemented the C versions, never
replied about the Lisp versions I offered.  He
just pushed the C code and passed over the Lisp
proposal in silence.  NIH?  Oh well.

  reply	other threads:[~2021-01-21 18:16 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13 19:26 Lift {global,local}-key-binding to Lisp Eli Zaretskii
2021-01-14 19:24 ` Stefan Kangas
2021-01-14 20:10   ` Eli Zaretskii
2021-01-14 20:24     ` Eli Zaretskii
2021-01-15  1:58     ` Leo Liu
2021-01-15  4:16     ` Óscar Fuentes
2021-01-15  7:42       ` Eli Zaretskii
2021-01-21 16:03     ` Stefan Kangas
2021-01-21 16:59       ` [External] : " Drew Adams
2021-01-21 17:50         ` Dmitry Gutov
2021-01-21 18:16           ` Drew Adams [this message]
2021-01-21 18:58             ` Dmitry Gutov
2021-01-21 19:59       ` Eli Zaretskii
2021-01-14 21:03   ` Andrea Corallo via Emacs development discussions.
2021-01-15  7:45     ` Eli Zaretskii
2021-01-15 12:09 ` Dmitry Gutov
2021-01-15 12:18   ` Eli Zaretskii
2021-01-15 13:24     ` Dmitry Gutov
2021-01-15 13:45       ` Eli Zaretskii
2021-01-15 18:09         ` Dmitry Gutov
2021-01-17 14:27           ` Christopher Miles
2021-01-15 18:03       ` Drew Adams
2021-01-16  0:51   ` Leo Liu
2021-01-17 14:33     ` Christopher Miles
2021-01-17 15:08       ` Eli Zaretskii
2021-01-18  3:29         ` Christopher Miles
2021-01-18 16:43           ` Eli Zaretskii
2021-01-17 16:10       ` Basil L. Contovounesios

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=SA2PR10MB4474AC8FDBDC3624A24D689BF3A19@SA2PR10MB4474.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=stefan@marxist.se \
    /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).