Subject: Re: bug#65017: 29.1; Byte compiler interaction with cl-lib function objects, removes symbol-function

From: Alan Mackenzie <[email-masked]>
Date: Sat, 5 Aug 2023 20:22:32 +0000

Hello, Eli

On Fri, Aug 04, 2023 at 08:35:30 +0300, Eli Zaretskii wrote:
> > Cc: [email-masked], [email-masked],
> >  Eric Marsden <[email-masked]>
> > Date: Thu, 3 Aug 2023 21:10:56 +0000
> > From: Alan Mackenzie <[email-masked]>

> Thanks, but when you have a solution in hand, please also check its
> effect on performance.  AFAIR, this part was tuned for optimal
> performance, back when symbols with positions were introduced; it
> would be a pity to lose performance due to fixing this bug, if that
> can be avoided.

This should really be in bug #65051, but:

I've run 

    time src/emacs -Q -batch --eval '(let ((a 1) (b 1) (times 10000000)) (while (> times 0) (equal a b) (setq times (1- times))))'

with different values for a and b (and slightly different quoting
syntax, sometimes).  I get the following results, reporting the "user:
time" from GNU/Linux:

New code:
    a, b = 1, 1: 1.760s 1.760s 1,746s
    a, b = 1, 3: 1.796s 1,772s 1.777s
           1.0, 1.0: 1,757s 1.776s 1.751s
	   1.0, 1.1: 1.792s 1.760s 1.779s
	   '(a b c), '(a b c): 2.041s 2.042s 2.039s
	   '(a b c), '(a b d): 2.096s 2.071s 2.084s
	   "1", "1": 1.841s 1.860s 1.845s
	   "1", "3": 1.865s 1.846s 1.869s

Old code:
   a, b = 1, 1: 1.744s 1.757s 1.762s
   a, b = 1, 3: 1.755s 1,777s 1.759s
          1.0, 1.0: 1.787s 1.748s 1.775s
	  1.0, 1.1: 1.762s 1.770s 1.774s
	  '(a b c), '(a b c): 2.021s 2.057s 2.019s
	  '(a b c), '(a b d): 2.046s 2.090s 2.100s
	  "1", "1": 1.854s 1.900s 1.884s
	  "1", "3": 1.849s 1.833s 1.838s

I think it's fair to say that the new code is not slower than the old
code, to within the measuring limits of these simple tests.  Any
differences, such as they are, are in the second and third decimal
places, and vary more between different measurements, than between the
Old code and New code.  They are surely too small to matter.

-- 
Alan Mackenzie (Nuremberg, Germany).