[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#71576: 30.0.50; [PATCH] Improve performance of Comint/Eshell passwor
From: |
Jim Porter |
Subject: |
bug#71576: 30.0.50; [PATCH] Improve performance of Comint/Eshell password prompt handling |
Date: |
Sat, 15 Jun 2024 12:50:01 -0700 |
How long can a password prompt really be? In Comint and Eshell, we check
for output from subprocesses that looks like a password prompt, so that
we can hide the password when the user types it in. That's good, but for
commands that output a lot of text, it can take a while to scan through
it all.
The attached patch adds a performance optimization for this: since we
only check for password prompts at the end of a block of output (the
subprocess is presumably waiting for the user to type in their
password), we only need to look at the last N characters, where N is
whatever the maximum password prompt length is. There's obviously no
*strict* maximum here, but I can't imagine a password prompt being
longer than 256 characters. Compared to the default
'read-process-output-max' value of 4096, this means we could skip up to
93% of the output when looking for the prompt.
In practice, this optimization makes us about 25% faster at outputting
large amounts of text. For example, in shell-mode, "cat config.log"
gives me the following results:
BEFORE | AFTER
--------+-------
3.852 | 2.890
3.728 | 2.771
3.568 | 2.716
The results in Eshell are pretty similar, too.
I've added NEWS entries for this, although maybe this isn't something
that really needs to be announced. Still, I figured it was worth
mentioning in the unlikely case that the new behavior could cause some
problem with (very!) long password prompts.
I'm also totally fine with letting this patch wait for Emacs 31 if
there's any concern about the code. It's not a big change, but maybe
it's worth erring on the side of stability.
0001-Limit-the-amount-of-text-we-examine-when-looking-for.patch
Description: Text document
- bug#71576: 30.0.50; [PATCH] Improve performance of Comint/Eshell password prompt handling,
Jim Porter <=