Subject: bug#44471: [PATCH] Simplify text-quoting-style

From: Eli Zaretskii <[email-masked]>
Date: Wed, 11 Nov 2020 21:24:46 +0200

> From: Stefan Kangas <[email-masked]>
> Date: Wed, 11 Nov 2020 14:12:24 -0500
> Cc: [email-masked], [email-masked]
> 
> >   . it slows down code of two very popular functions, because we now
> >     use EQ instead of a C-level equality operator;
> 
> If I understand correctly, EQ(x, y) ends up in a C-level equality
> operator and a typecast.  Is that correct?

No.  EQ either expands to a call to lisp_h_EQ, or calls lisp_h_EQ,
which does:

  #define lisp_h_EQ(x, y) (XLI (x) == XLI (y))

Depending on how Lisp_Object is represented, this could be a typecast
or an access to a struct member.

> If yes, is it the typecast
> that you think will cause a slowdown, or is it something else?

the function call and the struct access.

> I naively thought that this would not make much of a difference, and
> that, to the extent that it did, the relevant functions are hardly
> called often enough to matter in the end.

The difference is very minor, but the point is that it's a (minor)
disadvantage.

> >   . it introduces a function that has the same name as a variable,
> >     which adds a bit to confusion, and also defeats our method of
> >     reporting in what version was the function/variable introduced
> >     (try "C-h f"); and
> 
> This is not without precedent, see e.g. `user-full-name'.  But if we
> want to keep my patch we could of course just use the previous name
> `get-text-style' instead.
> 
> >   . I don't think I see the simplification that justifies these
> >     (admittedly quite minor) downsides
> 
> I agree it is minor, but I see one function less, one less enum, and
> overall fewer lines of code.
> 
> I'm happy to revert it if the change is not wanted.

I don't have strong opinions, so I will leave it to you and others.

My point, though, is that minor cleanups should preferably not have
adverse effects, otherwise their benefit is questionable.