[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lisp-level macro to avoid excessive GC in memory-allocating code
From: |
Stefan Monnier |
Subject: |
Re: Lisp-level macro to avoid excessive GC in memory-allocating code |
Date: |
Fri, 01 Jul 2022 09:56:52 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>> Is this aligned with what the implementation of the Lisp interpreter
>> actually does? I'm not sure we know, where we allocate memory for
>> Lisp data, whether we are going to bind some variable to the produced
>> data. Thus "count recent allocations within the current sexp" sounds
>> like non-trivial to implement.
That's also my impression.
> I am not 100% sure, but AFAIK lisp interpreter always knows the current
> lisp nesting level.
Not really, no. There is some related info, but that's a non-trivial
part of the cost of interpretation so any increase to that info will
tend to slow us down.
A simple `with-mostly-allocating-code` macro that increases
`gc-cons-percentage` to 1.0 sounds a lot simpler and won't impose any
extra burden on "normal" code.
Stefan