[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: |
Mon, 21 Aug 2023 10:46:59 +0000 |
"Alfred M. Szmidt" <ams@gnu.org> writes:
>> I am talking about the end result (native code) we achieve after
>> converting source Elisp into byte-code and then into native code. Not
>> about the byte code.
>
> The end result depends on what the Emacs Lisp compiler produces,
> Native compilation will not figure out that using ASSQ is better when
> calling ASSOC has fixnums in it (see byte-opt.el for example of the
> required Lisp wrangling that is required -- and something that SBCL
> does in a much larger scale).
>
> That is the type of optimizations that matter more than JIT.
Native compilation can actually do it. And it can (AFAIU) do it more
efficiently compared to what we have in byte-opt.el, because it uses
more sophisticated data flow analysis to derive type information.
If we look into Fassoc implementation, it starts with
if (eq_comparable_value (key) && NILP (testfn))
return Fassq (key, alist);
...
eq_comparable_value (Lisp_Object x)
{
return SYMBOLP (x) || FIXNUMP (x);
}
If we have a "libgccjit IR" implementation for Fassoc (see "3.8final (code
layout) in https://zenodo.org/record/3736363", the type information can
transform assoc call into assq call during compile time.
The other question is that `assoc' in particular is currently not
implemented in "libgccjit IR". But it can be added, together with other
important primitives.
--
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>
- Re: Shrinking the C core, (continued)
- 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/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,
Ihor Radchenko <=
- 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, Ihor Radchenko, 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, 2023/08/20
- Re: Shrinking the C core, Ihor Radchenko, 2023/08/20
- Re: Shrinking the C core, Alfred M. Szmidt, 2023/08/20