[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shrinking the C core
From: |
Alfred M. Szmidt |
Subject: |
Re: Shrinking the C core |
Date: |
Sun, 20 Aug 2023 12:03:30 -0400 |
"Alfred M. Szmidt" <ams@gnu.org> writes:
> Please keep the CC intact, not everyone subscribed.
>
> > It should be quite obvious why SBCL is faster than the Emacs
> > Lisp VM (or even native). Just look at this call to (car
> > "foo"), and compare what happens in Emacs.
> >
> > * (disassemble 'foo)
> > ; disassembly for FOO
> > ; Size: 166 bytes. Origin: #x225D873F ; FOO
>> ...
> Okay?
>
> I guess that you do not understand the above? Or what? Do you know
> and understand what happens in Emacs when a similar call is done? It
> is far more than "166 bytes".
It would be helpful if you show us what happens in Elisp with a
similar call. Especially after native compilation.
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_.
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).
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.
I am asking genuinely because `car' (1) has dedicated opt code and thus
should be one of the best-optimized function calls on Elisp side; (2)
Fcar is nothing but
/* Take the car or cdr of something whose type is not known. */
INLINE Lisp_Object
CAR (Lisp_Object c)
{
if (CONSP (c))
return XCAR (c); // <- XCONS (c)->u.s.car
if (!NILP (c))
wrong_type_argument (Qlistp, c);
return Qnil;
}
So, it is a very simple example that can actually explain the basic
differences between Elisp and CL. It would be nice if you (considering
your low-level understanding) can provide us with an analysis of what is
different between Elisp and CL implementations of such a simple
function.
- Re: Shrinking the C core, (continued)
- Re: Shrinking the C core, Alfred M. Szmidt, 2023/08/21
- Re: Shrinking the C core, Ihor Radchenko, 2023/08/21
- Re: Shrinking the C core, Alfred M. Szmidt, 2023/08/21
- Re: Shrinking the C core, Ihor Radchenko, 2023/08/21
- Re: Shrinking the C core, Alfred M. Szmidt, 2023/08/21
- Re: Shrinking the C core, Emanuel Berg, 2023/08/27
- Re: Shrinking the C core, Ihor Radchenko, 2023/08/27
- Re: Shrinking the C core, Emanuel Berg, 2023/08/27
- Re: Shrinking the C core, Emanuel Berg, 2023/08/27
- Re: Shrinking the C core, Ihor Radchenko, 2023/08/27
- Re: Shrinking the C core,
Alfred M. Szmidt <=
- Re: Shrinking the C core, Ihor Radchenko, 2023/08/20
- Re: Shrinking the C core, Alfred M. Szmidt, 2023/08/20
- Re: Shrinking the C core, Ihor Radchenko, 2023/08/20
- Re: Shrinking the C core, Alfred M. Szmidt, 2023/08/20
- Re: Shrinking the C core, Eli Zaretskii, 2023/08/20
- Re: Shrinking the C core, Alfred M. Szmidt, 2023/08/20
- Re: Shrinking the C core, Emanuel Berg, 2023/08/24
- Re: Shrinking the C core, Richard Stallman, 2023/08/25
- Re: Shrinking the C core, Eli Zaretskii, 2023/08/26
- Re: Shrinking the C core, Emanuel Berg, 2023/08/26