Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

Barry barry at barrys-emacs.org
Fri Oct 7 13:04:33 EDT 2022



> On 7 Oct 2022, at 16:48, Skip Montanaro <skip.montanaro at gmail.com> wrote:
> 
> On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames <andreas.0815.qwertz at gmail.com>
> wrote:
> 
>> 1. The culprit was me. As lazy as I am, I have used f-strings all over the
>> place in calls to `logging.logger.debug()` and friends, evaluating all
>> arguments regardless of whether the logger was enabled or not.
>> 
> 
> I thought there was some discussion about whether and how to efficiently
> admit f-strings to the logging package. I'm guessing that's not gone
> anywhere (yet).

That cannot be done as the f-string is computed before the log call.

Maybe you are thinking of the lazy expression idea for this. That idea
seems to have got no where as its not clear how to implement it without
performance issues.

Barry

> 
> Skip
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 



More information about the Python-list mailing list