emacs-devel
[Top][All Lists]
Advanced

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

Re: Shrinking the C core


From: Ihor Radchenko
Subject: Re: Shrinking the C core
Date: Sun, 20 Aug 2023 16:34:49 +0000

"Alfred M. Szmidt" <ams@gnu.org> writes:

> I'll suggest that you try to figure it out, it is a good exercise.
> But the big difference is that there is much more indirection between
> what SBCL does and what Emacs Lisp does.  SBCL is a much more
> aggressive optimizer of code.  Emacs simply cannot optimize much of
> the call _flow_.

Ok. Here is what I got for Elisp `car':

Dump of assembler code for function Fcar:
Address range 0x200250 to 0x20026c:
   0x0000000000200250 <+0>:     lea    -0x3(%rdi),%eax
   0x0000000000200253 <+3>:     test   $0x7,%al
   0x0000000000200255 <+5>:     jne    0x200260 <Fcar+16>
   0x0000000000200257 <+7>:     mov    -0x3(%rdi),%rax
   0x000000000020025b <+11>:    ret
   0x000000000020025c <+12>:    nopl   0x0(%rax)
   0x0000000000200260 <+16>:    test   %rdi,%rdi
   0x0000000000200263 <+19>:    jne    0x5007d <Fcar.cold>
   0x0000000000200269 <+25>:    xor    %eax,%eax
   0x000000000020026b <+27>:    ret
Address range 0x5007d to 0x5008b:
   0x000000000005007d <-1769939>:       push   %rax
   0x000000000005007e <-1769938>:       mov    %rdi,%rsi
   0x0000000000050081 <-1769935>:       mov    $0xaf20,%edi
   0x0000000000050086 <-1769930>:       call   0x4ffc7 <wrong_type_argument>

Does not look too bad in terms of the number of instructions. And I do
not see any obvious indirection. 

> And then you will generally either have byte compiler, or interpreted
> code to handle (ignoring native compile, since must people probobly
> still use the VM) -- all code in SBCL is comnpiled (EVAL is essentially
> a call to the compiler, and then executed).

IMHO, we should not ignore native compile. If we want to improve the
peak performance of Elisp, native compile should be essential part of
it. Then, for real improvements, we should better focus on what native
compile cannot optimize.

> As an idea, I would take the Gabriel benchmarks and run them in SBCL
> vs. Emacs.  Take one, and investigate what they do in detail...  You
> will see that the two worlds are universes far apart.

Sure. That's what I asked Emanuel to do.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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