Subject: bug#28227: 26.0.50; Tramp tests are slow

From: Michael Albinus <[email-masked]>
Date: Fri, 25 Aug 2017 10:04:24 +0200

Gemini Lasswell <[email-masked]> writes:

Hi Gemini,

> The Tramp tests are the slowest tests in Emacs's test suite, even when
> they aren't set up to access a remote machine.

Tramp tests are expensive, by design. For example, at the beginning of
every single test the Tramp connection is cleared, including cache
cleanup. 55 tests, this takes time to reestablish the
connection. Furthermore, for all remote process related tests there are
timeouts in order to receive proper response.

Therefore, in the normal "make check" run of Emacs, some of Tramp tests
are skipped.

If you start "make -C test tramp-tests", all Tramp tests run, which
lasts 3:17 min on my laptop (Lenovo T500, 7 years old). You could
restrict this to the non-expensive tests by calling "make
SELECTOR='$(SELECTOR_DEFAULT)' -C test tramp-tests". This reduces the
runtime to 34 sec on my laptop. See test/README for explanation.

For normal use, the non-expensive Tramp tests are sufficient.

> After a little investigation I think the cause of the slowness is
> excessive memory allocation. I modified ert-run-tests to print
> memory statistics after each test and found that tramp-tests.el, which
> takes 100 seconds to run on my machine, is spending 39 seconds doing
> garbage collection, and by the end of the test run has allocated and
> freed 27 million strings.
>
> Here is a log file with memory statistics:
>
> And here are the messages I added to ert-run-test's loop:
>
> (message "GC: %s" (garbage-collect))
> (message "GC count: %s time: %s" gcs-done gc-elapsed)
> (message "Memory-use-counts: %s" (memory-use-counts))

Thanks for this. My experience with Tramp is, that most of the time is
spent in process communication.

Anyway, I'll see, whether I could optimize Tramp somehow, but
functionality comes first.

Best regards, Michael.