[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ideal performance of ELisp
From: |
Lynn Winebarger |
Subject: |
Re: Ideal performance of ELisp |
Date: |
Tue, 16 Aug 2022 12:46:25 -0400 |
On Sat, Aug 13, 2022 at 10:56 AM Lynn Winebarger <owinebar@gmail.com> wrote:
>
> On Sat, Aug 13, 2022, 10:07 AM Stefan Monnier <monnier@iro.umontreal.ca>
> wrote:
>>
>> >> > Once the VM supports proper tail recursion, it's straightforward to
>> >> > generate automata that never perform a function call, at least not as
>> >> > part
>> >> > of the recognizer.
>> >>
>> >> It was straightforward beforehand as well (using a `while` loop instead
>> >> of recursion). And if you do use recursion, then it's not very much
>> >> simpler with `lexical-binding` than without because you still have to
>> >> take into account the possibility that the function gets redefined
>> >> during your recursion :-(
>> >>
>> >
>> > I think you're mistaking self-tail recursion for tail recursion.
>>
>> No, I was simply restricting the discussion to the case you mention of
>> "generat[ing an] automata", in which case you usually have enough
>> control over the generated code to use a `while` loop if desired.
>
>
> It's true you can avoid funcall dispatch overhead that way, but unless I'm
> missing something you are stuck with the overhead of the while loop plus
> whatever conditional branching mechanism you would use for dispatching to a
> state label, as opposed to simply jumping to the contents of a register. I'm
> not 100% on whether there's an ELisp construct that the byte compiler can
> turn into byte code that uses a table of labels for conditional dispatch the
> way a switch statement may be implemented in C.
>
BTW, I was being serious - if there's a way to write a simple jump to
do case-dispatching for that trampolining while loop, I'd definitely
look at making semantic produce such automata so the native compiler,
in particular, could optimize the result properly.
Plug for inline LAP versus "C-like DSL" - At least then you could
generate bytecode that jumps to calculated offsets, by constructing a
hash table of symbol values to byte-code labels only available at
assembly time?
Lynn
- Re: Why tree-sitter instead of Semantic? (was Re: CC Mode with font-lock-maximum-decoration 2), (continued)
- Re: Why tree-sitter instead of Semantic? (was Re: CC Mode with font-lock-maximum-decoration 2), Eli Zaretskii, 2022/08/10
- Re: Why tree-sitter instead of Semantic? (was Re: CC Mode with font-lock-maximum-decoration 2), Lynn Winebarger, 2022/08/12
- Re: Why tree-sitter instead of Semantic? (was Re: CC Mode with font-lock-maximum-decoration 2), Eli Zaretskii, 2022/08/12
- Ideal performance of ELisp (was: Why tree-sitter instead of Semantic? (was Re: CC Mode with font-lock-maximum-decoration 2)), Stefan Monnier, 2022/08/12
- Re: Ideal performance of ELisp (was: Why tree-sitter instead of Semantic? (was Re: CC Mode with font-lock-maximum-decoration 2)), Lynn Winebarger, 2022/08/12
- Re: Ideal performance of ELisp, Stefan Monnier, 2022/08/12
- Re: Ideal performance of ELisp, Lynn Winebarger, 2022/08/13
- Re: Ideal performance of ELisp, Lynn Winebarger, 2022/08/13
- Re: Ideal performance of ELisp, Stefan Monnier, 2022/08/13
- Re: Ideal performance of ELisp, Lynn Winebarger, 2022/08/13
- Re: Ideal performance of ELisp,
Lynn Winebarger <=
- Re: Ideal performance of ELisp, Stefan Monnier, 2022/08/16
- Re: Ideal performance of ELisp, Lynn Winebarger, 2022/08/17
- Re: Ideal performance of ELisp, Stefan Monnier, 2022/08/17
- Re: Ideal performance of ELisp, Mattias EngdegÄrd, 2022/08/17
- Re: Ideal performance of ELisp, Stefan Monnier, 2022/08/17
- Re: Ideal performance of ELisp, Lynn Winebarger, 2022/08/17
- Re: Ideal performance of ELisp (was: Why tree-sitter instead of Semantic? (was Re: CC Mode with font-lock-maximum-decoration 2)), Ihor Radchenko, 2022/08/13
- Re: Ideal performance of ELisp, Philip Kaludercic, 2022/08/13
- Re: Ideal performance of ELisp, Ihor Radchenko, 2022/08/13
- Re: Ideal performance of ELisp, Stefan Monnier, 2022/08/13