GNU bug report logs - #69480
Emacs Lisp needs, for its great 'native-compile', 'declare' and 'the' for fixnums and arrays.

Previous Next

Package: emacs;

Reported by: Robert Boyer <robertstephenboyer <at> gmail.com>

Date: Thu, 29 Feb 2024 19:42:02 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: robertstephenboyer <at> gmail.com, 69480 <at> debbugs.gnu.org, acorallo <at> gnu.org
Subject: bug#69480: Emacs Lisp needs, for its great 'native-compile', 'declare' and 'the' for fixnums and arrays.
Date: Fri, 01 Mar 2024 14:07:50 +0100
On Fri, 01 Mar 2024 14:45:39 +0200 Eli Zaretskii <eliz <at> gnu.org> wrote:

>> From: Stephen Berman <stephen.berman <at> gmx.net>
>> Cc: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of
>>  text editors" <bug-gnu-emacs <at> gnu.org>,  Eli Zaretskii <eliz <at> gnu.org>,
>>   Robert Boyer <robertstephenboyer <at> gmail.com>,  69480 <at> debbugs.gnu.org
>> Date: Fri, 01 Mar 2024 13:33:56 +0100
>>
>> On Fri, 01 Mar 2024 07:18:29 -0500 Andrea Corallo <acorallo <at> gnu.org> 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?

I see a similar allocation, but I have 16 GB of RAM (~12 of which were
free when I ran the benchmark), so I think that shouldn't be an issue.

> Anyway, profiling could give some hints.

That says almost all memory and CPU are consumed by `build-sieve':

    807,918,497  99% - command-execute
    806,047,846  99%  - funcall-interactively
    804,440,179  99%   - eval-expression
    804,440,179  99%    - #<compiled -0x5db3e1955cb81d1>
    804,440,179  99%     - #<compiled -0x88d7268f58840fe>
    804,440,179  99%      - eval
    804,440,179  99%       - progn
    800,000,184  99%        - benchmark-call
    800,000,104  99%         - #<lambda 0x8b1d56ce50812>
    800,000,104  99%          - build-sieve
             40   0%             expt
             80   0%           time-since
      4,439,995   0%        + emacs-lisp-native-compile-and-load
      1,607,667   0%   + execute-extended-command
      1,870,651   0%  + byte-code
         99,848   0% + redisplay_internal (C function)
          1,729   0%   Automatic GC
          1,416   0% + timer-event-handler
          1,180   0% + ...

But I don't see how that bears on the difference between native and byte
compilation in my timings versus yours and Andrea's.

Steve Berman




This bug report was last modified 166 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.