[Top][All Lists]

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

Correct byte compiler error/warning positions. The solution!

From: Alan Mackenzie
Subject: Correct byte compiler error/warning positions. The solution!
Date: Fri, 26 Nov 2021 19:56:21 +0000

Hello, Emacs.

A short while ago, I mused on a solution to the incorrect positions we
get in byte compiler warning/error messages.  My proposed solution
turned out to be impractical fantasy - it didn't and couldn't work,
because of the difficulties of getting macros to play nicely.

However, I've now hit on the answer.

My 2018 solution to the problem _was_ a solution.  It just ran somewhere
around 8% more slowly than the original it was branched from, hence was
deemed unacceptable by other hackers here.

The reason for the slowdown was the modification to the EQ macro in
lisp.h.  It became necessary to check whether "symbols with position"
were enabled whenever the first == comparison didn't match.

A _LOT_ of these comparisons were for NILP, which is just #defined as EQ
(arg, Qnil).  However if NILP were to be defined directly as arg ==
Qnil, it would bypass the overhead in EQ.  Also required here is for the
reader to handle a literal "nil" specially, and return the
non-positioned symbol `nil' for it, rather than a positioned `nil'.

I've just tried out the above on my 2018 proposed code.  On a benchmark,
the new attempt ran 7.3% faster than the 2018 version.  It thus seems
likely that this strategem will give correct positions in warning
messages without such an unacceptable slowdown.

I'm going to try it out on an up to date repository.

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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