bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#69480: Emacs Lisp needs, for its great 'native-compile', 'declare' a


From: Stephen Berman
Subject: bug#69480: Emacs Lisp needs, for its great 'native-compile', 'declare' and 'the' for fixnums and arrays.
Date: Fri, 01 Mar 2024 14:53:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

On Fri, 01 Mar 2024 15:41:24 +0200 Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Stephen Berman <stephen.berman@gmx.net>
>> Cc: acorallo@gnu.org,  bug-gnu-emacs@gnu.org,  robertstephenboyer@gmail.com,
>>   69480@debbugs.gnu.org
>> Date: Fri, 01 Mar 2024 14:07:50 +0100
>>
>> On Fri, 01 Mar 2024 14:45:39 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
>>
>> >> 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':
>
> This is skewed, use cpu profiling instead of "memory" profiling.

Ah, ok.

>> But I don't see how that bears on the difference between native and byte
>> compilation in my timings versus yours and Andrea's.
>
> My suggestion was to compare profiles in the byte-compiled and
> native-compiled cases.
>
> Btw, are you running both cases in the same session?  If so, don't:
> restart Emacs and run the other case instead.

Ok, I've now done that.  Here's the report for the run with native
compilation:

       12599  95% - command-execute
       12487  95%  - funcall-interactively
       12486  95%   - eval-expression
       12485  95%    - #<compiled -0x5db3e1955cb81d1>
       12485  95%     - #<compiled -0x8a5cf032951a0fe>
       12480  95%      - eval
       12480  95%       - progn
       12367  94%        - benchmark-call
       12367  94%         - #<lambda 0x8c97b8cb7bd82>
       12367  94%            build-sieve
         113   0%        - emacs-lisp-native-compile-and-load
         113   0%         - emacs-lisp-native-compile
         113   0%          - native-compile
          79   0%           - comp--native-compile
          37   0%            - comp--fwprop
          25   0%             - #<subr 
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_109>
          25   0%              - comp--fwprop*
          25   0%               - maphash
          25   0%                - #<compiled 0xf5cda0529cb6e6>
          22   0%                 - comp--fwprop-insn
          20   0%                  - comp-cstr-intersection
          19   0%                   - comp-cstr-intersection-no-mem
          19   0%                    - apply
          19   0%                     - comp-cstr-intersection-homogeneous
          19   0%                      - apply
          19   0%                       - comp-intersect-typesets
          19   0%                        - comp-normalize-typeset
          19   0%                         - comp--normalize-typeset0
          19   0%                          - comp--direct-subtypes
          18   0%                           - comp--direct-supertypes
          18   0%                            - comp-supertypes
           4   0%                               comp--intersection
           1   0%                           - cl-sort
           1   0%                              #<subr comp--sym-lessp>
           1   0%                     comp-cstr-copy
           2   0%                  - comp-cstr-union-no-range
           2   0%                   - comp-cstr-union-1
           2   0%                    - comp-cstr-union-1-no-mem
           2   0%                     - apply
           2   0%                      - comp-cstr-union-homogeneous
           2   0%                       - comp-cstr-union-homogeneous-no-range
           1   0%                        - comp-union-typesets
           1   0%                         - comp-normalize-typeset
           1   0%                          - comp--normalize-typeset0
           1   0%                           - comp--direct-subtypes
           1   0%                            - comp--direct-supertypes
           1   0%                               comp-supertypes
           1   0%                        - comp-normalize-valset
           1   0%                           cl-sort
           1   0%                 - comp--copy-insn
           1   0%                  - comp--copy-insn
           1   0%                     copy-comp-mvar
          10   0%             - comp--ssa
          10   0%              - #<subr 
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_100>
           7   0%               - comp--ssa-rename
           7   0%                - #<compiled 0x1cb53415437137ed>
           7   0%                 - #<compiled 0x1cb53415437137ed>
           4   0%                  - #<compiled 0x1cb55f52f37137ed>
           4   0%                   - #<compiled 0x1cb55f52f37137ed>
           4   0%                    - #<compiled 0x1cb55f52f37137ed>
           4   0%                     - #<compiled 0x1cb55f52f37137ed>
           4   0%                      - #<compiled 0x1cb55f52f37137ed>
           2   0%                       - comp--ssa-rename-insn
           2   0%                        - cl-nsubst-if
           2   0%                         - cl-nsublis
           2   0%                          - cl--nsublis-rec
           2   0%                           - cl--nsublis-rec
           1   0%                              #<compiled 0x293a3dbb887bc18>
           1   0%                              cl--nsublis-rec
           2   0%                       - #<compiled 0x1cb508a8837137ed>
           2   0%                        - #<compiled 0x1cb508a8837137ed>
           2   0%                         - #<compiled 0x1cb508a8837137ed>
           1   0%                          - #<compiled 0x1cb508a8837137ed>
           1   0%                           - comp--ssa-rename-insn
           1   0%                              comp--assign-op-p
           1   0%                          - comp--ssa-rename-insn
           1   0%                           - cl-nsubst-if
           1   0%                            - cl-nsublis
           1   0%                             - cl--nsublis-rec
           1   0%                                #<compiled 0x293a3d93887bc18>
           3   0%                  - comp--ssa-rename-insn
           3   0%                   - cl-nsubst-if
           3   0%                    - cl-nsublis
           3   0%                     - cl--nsublis-rec
           2   0%                      - cl--nsublis-rec
           1   0%                         #<compiled 0x293a3dbb887bc18>
           1   0%                       - cl--nsublis-rec
           1   0%                        - #<compiled 0x293a3dbb887bc18>
           1   0%                           type-of
           1   0%                        #<compiled 0x293a3dbb887bc18>
           1   0%                 comp--compute-dominator-tree
           1   0%               - comp--compute-edges
           1   0%                  #<subr 
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_80>
           1   0%               - comp--log-block-info
           1   0%                  #<subr 
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_86>
           2   0%             - comp--dead-code
           2   0%              - #<subr 
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_115>
           2   0%                 comp--dead-assignments-func
          22   0%            - comp--spill-lap
          16   0%             - comp--spill-lap-function
          16   0%              - apply
          16   0%               - #<compiled -0x11c2c6042193c0b4>
          16   0%                - byte-compile-file
          15   0%                 - byte-compile-from-buffer
          15   0%                  - bytecomp--displaying-warnings
           9   0%                   - byte-compile-log-file
           9   0%                    - emacs-lisp-compilation-mode
           9   0%                     - compilation-mode
           5   0%                      - byte-code
           5   0%                       - require
           2   0%                        - byte-code
           2   0%                           require
           1   0%                        - custom-declare-face
           1   0%                           quote
           6   0%                   - #<compiled -0x14c9cececd5ff012>
           6   0%                    - byte-compile-toplevel-file-form
           6   0%                     - byte-compile-recurse-toplevel
           3   0%                      - #<subr 
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_50>
           3   0%                       - byte-compile-file-form
           2   0%                        - byte-compile-file-form-defvar
           2   0%                         - byte-compile-defvar
           2   0%                          - byte-compile-top-level
           2   0%                             byte-optimize-one-form
           1   0%                        - byte-compile-file-form-defalias
           1   0%                         - #<compiled -0x134743fab8beb490>
           1   0%                          - byte-compile-file-form-defmumble
           1   0%                             set-message-functions
           3   0%                      - macroexp-macroexpand
           3   0%                         macroexpand-1
           1   0%                 - normal-mode
           1   0%                  - set-auto-mode
           1   0%                     inhibit-local-variables-p
           6   0%             - comp-cstr-ctxt-update-type-slots
           3   0%              - comp--compute-typeof-types
           3   0%               - comp--all-classes
           3   0%                - #<compiled -0xc298594251b9291>
           1   0%                   cl-find-class
           3   0%              - comp--compute--pred-type-h
           3   0%               - comp--all-classes
           2   0%                - #<compiled -0xc298594251b9291>
           1   0%                   cl-find-class
          15   0%            - comp--final
          12   0%             - redisplay_internal (C function)
           1   0%              - jit-lock-function
           1   0%               - jit-lock-fontify-now
           1   0%                - jit-lock--run-functions
           1   0%                 - #<compiled 0x1baf465008c447bf>
           1   0%                  - font-lock-fontify-region
           1   0%                   - font-lock-default-fontify-region
           1   0%                    - font-lock-fontify-keywords-region
           1   0%                       lisp--match-hidden-arg
           1   0%              - redisplay--pre-redisplay-functions
           1   0%                 window-buffer
           2   0%               #<subr 
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_130>
           3   0%            - make-comp-ctxt
           2   0%             - comp--compute-typeof-types
           2   0%                comp--all-classes
           1   0%             - comp--compute--pred-type-h
           1   0%              - comp--all-classes
           1   0%                 #<compiled -0xc298594251b9291>
           1   0%              time-since
           1   0%            - comp--limplify
           1   0%             - #<subr 
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_58>
           1   0%              - comp--limplify-function
           1   0%               - comp--limplify-block
           1   0%                  comp--limplify-lap-inst
          16   0%           - byte-code
          16   0%            - require
           4   0%             - byte-code
           4   0%              - require
           2   0%               - byte-code
           2   0%                - require
           1   0%                 - defvar
           1   0%                  - byte-code
           1   0%                     tool-bar-local-item-from-menu
          12   0%           - defconst
          12   0%            - byte-code
           6   0%             - make-comp-cstr-ctxt
           4   0%              - comp--compute-typeof-types
           4   0%               - comp--all-classes
           3   0%                - #<compiled -0xc298594251b9291>
           3   0%                   cl-find-class
           2   0%              - comp--compute--pred-type-h
           2   0%               - comp--all-classes
           2   0%                - #<compiled -0xc298594251b9291>
           1   0%                   cl-find-class
           6   0%             - comp-type-spec-to-cstr
           6   0%              - #<subr 
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_54>
           6   0%               - comp-type-spec-to-cstr
           5   0%                - comp-cstr-union-make
           5   0%                 - comp-cstr-union
           5   0%                  - comp-cstr-union-1
           5   0%                   - comp-cstr-union-1-no-mem
           5   0%                    - apply
           5   0%                     - comp-cstr-union-homogeneous
           5   0%                      - comp-cstr-union-homogeneous-no-range
           5   0%                       - comp-union-typesets
           5   0%                        - comp-normalize-typeset
           3   0%                         - comp--normalize-typeset0
           3   0%                          - comp--direct-subtypes
           3   0%                           - comp--direct-supertypes
           3   0%                              comp-supertypes
           2   0%                           cl-remove-duplicates
           1   0%                - comp-type-spec-to-cstr
           1   0%                 - comp-cstr-union-make
           1   0%                  - comp-cstr-union
           1   0%                   - comp-cstr-union-1
           1   0%                    - comp-cstr-union-1-no-mem
           1   0%                     - apply
           1   0%                      - comp-cstr-union-homogeneous
           1   0%                       - comp-cstr-union-homogeneous-no-range
           1   0%                        - comp-union-typesets
           1   0%                         - comp-normalize-typeset
           1   0%                          - comp--normalize-typeset0
           1   0%                           - comp--direct-subtypes
           1   0%                            - comp--direct-supertypes
           1   0%                             - comp-supertypes
           1   0%                                comp--intersection
           5   0%      - macroexpand-all
           5   0%       - macroexp--expand-all
           5   0%        - macroexp--all-forms
           5   0%         - macroexp--expand-all
           5   0%          - macroexp-macroexpand
           5   0%             macroexpand-1
           1   0%     execute-extended-command
         112   0%  - byte-code
          66   0%   - read--expression
          38   0%    - redisplay_internal (C function)
           1   0%       redisplay--pre-redisplay-functions
           5   0%    - command-execute
           5   0%     - funcall-interactively
           2   0%      - yank
           2   0%       - current-kill
           2   0%        - gui-selection-value
           2   0%         - gui--selection-value-internal
           2   0%          - gui-get-selection
           2   0%           - gui-backend-get-selection
           2   0%            - apply
           2   0%             - #<compiled 0xb78d7eebc4d3cfc>
           2   0%                x-get-selection-internal
           2   0%        delete-indentation
           1   0%      - read--expression-try-read
           1   0%         read
           2   0%    - timer-event-handler
           2   0%     - apply
           2   0%      - #<subr 
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_12>
           2   0%       - eldoc-print-current-symbol-info
           2   0%        - eldoc--invoke-strategy
           2   0%         - eldoc-documentation-default
           2   0%          - #<subr 
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_17>
           2   0%           - elisp-eldoc-funcall
           2   0%            - elisp--fnsym-in-current-sexp
           2   0%             - syntax-ppss
           2   0%                parse-partial-sexp
          46   0%   - read-extended-command
          46   0%    - read-extended-command-1
          46   0%     - completing-read-default
          26   0%      - redisplay_internal (C function)
           1   0%       - redisplay--pre-redisplay-functions
           1   0%        - run-hook-with-args
           1   0%           redisplay--update-region-highlight
           2   0%      - timer-event-handler
           2   0%       - apply
           2   0%        - #<subr 
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_9>
           2   0%           jit-lock-context-fontify
         489   3%   Automatic GC
          15   0% + timer-event-handler
          14   0% + redisplay_internal (C function)
          13   0% + ...

And here's the report for the run with byte compilation:

        9055  95% - command-execute
        8994  95%  - funcall-interactively
        8993  95%   - eval-expression
        8993  95%    - #<compiled -0x5db3e1955cb81d1>
        8993  95%     - #<compiled 0x1be2f2b973e98d46>
        8988  95%      - eval
        8988  95%       - benchmark-call
        8988  95%        - #<lambda 0x8f52207467a22>
        8988  95%         - build-sieve
         206   2%            ash
         169   1%            make-vector
           5   0%      - macroexpand-all
           5   0%       - macroexp--expand-all
           5   0%        - macroexp-macroexpand
           5   0%           macroexpand-1
           1   0%     execute-extended-command
          61   0%  - byte-code
          37   0%   - read-extended-command
          37   0%    - read-extended-command-1
          37   0%     - completing-read-default
          18   0%        redisplay_internal (C function)
           1   0%        clear-minibuffer-message
           1   0%      - timer-event-handler
           1   0%       - apply
           1   0%        - show-paren-function
           1   0%         - show-paren--default
           1   0%            show-paren--locate-near-paren
          24   0%   - read--expression
          12   0%      redisplay_internal (C function)
           1   0%    - minibuffer-mode
           1   0%     - run-mode-hooks
           1   0%      - run-hooks
           1   0%       - global-font-lock-mode-enable-in-buffers
           1   0%        - turn-on-font-lock-if-desired
           1   0%         - turn-on-font-lock
           1   0%          - font-lock-mode
           1   0%           - called-interactively-p
           1   0%              backtrace-frame
           1   0%    - command-execute
           1   0%     - funcall-interactively
           1   0%      - yank
           1   0%       - current-kill
           1   0%        - gui-selection-value
           1   0%         - gui--set-last-clipboard-selection
           1   0%          - gui-backend-get-selection
           1   0%           - apply
           1   0%            - #<compiled 0xb78ea5818013cfc>
           1   0%               x-get-selection-internal
         345   3%   Automatic GC
          23   0% + timer-event-handler
          12   0% + redisplay_internal (C function)
          10   0% + ...

Steve Berman





reply via email to

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