[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: |
Mon, 21 Aug 2023 03:52:30 -0400 |
> > ... In Lisp you
> > never know the types of things.
>
> This is not true.
>
> It is absolutley true, you cannot know what the value of a variable is
> without checking the type of it at run time. Variables have no type
> information.
What about
(progn
(setq x (list 'a 'b 'c))
(listp x))
`listp' call can definitely be optimized once the compiler knows that
`list' returns a list.
A sufficiently smart compiler would optimize that to T sure, the Emacs
Lisp compiler doesn't. And that is one of the issues, native
compilation or not, since right now native compilation gets this to
work with, and it cannot do magic no matter how much magic dust you
give it.
byte code for foo:
args: nil
0 constant a
1 constant b
2 constant c
3 list3
4 dup
5 varset x
6 listp
7 return
Native compilation will not help you when you need to figure out what
is to be done in:
(defun foo (x) (assoc x '((123 . a) (456 . b) (798 c))))
E.g., to call ASSQ instead, since it is just fixnums, and ASSOC uses
EQUAL which is "slow". The Emacs Lisp compiler cannot optimize that
code today, and native compilation will get whatever the compiler
produced, with the call to ASSOC no matter what.
That is what it means to optimize Lisp code.
- Re: Shrinking the C core, (continued)
- Re: Shrinking the C core, Ihor Radchenko, 2023/08/21
- Re: Shrinking the C core, Eli Zaretskii, 2023/08/21
- Re: Shrinking the C core, Ihor Radchenko, 2023/08/21
- Re: Shrinking the C core, Eli Zaretskii, 2023/08/21
- Re: Shrinking the C core, Ihor Radchenko, 2023/08/23
- Re: Shrinking the C core, Emanuel Berg, 2023/08/20
- 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 <=
- Re: Shrinking the C core, Ihor Radchenko, 2023/08/21
- Re: Shrinking the C core, Emanuel Berg, 2023/08/22
- Re: Shrinking the C core, Alfred M. Szmidt, 2023/08/23
- Re: Shrinking the C core, Emanuel Berg, 2023/08/23
- Re: Shrinking the C core, Emanuel Berg, 2023/08/25
- Re: Shrinking the C core, Emanuel Berg, 2023/08/20
- Re: Shrinking the C core, tomas, 2023/08/20
- Re: Shrinking the C core, Ihor Radchenko, 2023/08/20
- RE: [External] : Re: Shrinking the C core, Drew Adams, 2023/08/20
- Type declarations in Elisp (was: [External] : Re: Shrinking the C core), Ihor Radchenko, 2023/08/21