Subject: Re: bug#69480: Emacs Lisp needs, for its great 'native-compile', 'declare' and 'the' for fixnums and arrays.

From: Eli Zaretskii <[email-masked]>
Date: Fri, 01 Mar 2024 14:45:39 +0200

> From: Stephen Berman <[email-masked]>
> Cc: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of
>  text editors" <[email-masked]>,  Eli Zaretskii <[email-masked]>,
>   Robert Boyer <[email-masked]>,  [email-masked]
> Date: Fri, 01 Mar 2024 13:33:56 +0100
> 
> On Fri, 01 Mar 2024 07:18:29 -0500 Andrea Corallo <[email-masked]> wrote:
> 
> >> Why is the timing with native compilation so much slower than with byte
> >> compilation?
> >
> > Because the file is not lexically scoped so we are not running
> > optimizations.
> 
> Ah, ok.
> 
> > On my laptop I see:
> >
> > 11 secs byte compiled
> > 18 secs native compiled
> >
> > 7 secs byte compiled with lexical scope
> > 5 secs  native compiled with lexical scope.
> 
> I got these timings with lexical scope:
> 
> native compiled: (12.717023709000001 1 0.34653286699999997)
>   byte compiled: (9.597325325 1 0.38987931)
> 
> It's still slower with native compilation than with byte compilation on
> my machine, unlike on yours.  Do you have any idea why?

Maybe your system takes time to allocate memory?  This program
allocates almost 850MB of memory on my system, so maybe yours starts
paging?

Anyway, profiling could give some hints.