Anybody figured out where autotest spends time *at runtime*? I tried to
track something there, but never really got anywhere.
Easy: parsing. Even with
cd autoconf/tests && ./testsuite 1
Cool, so my patches will indeed speed up run-time a little bit. Or more
accurately, initialization time, because parsing is done only once.
Indeed, to verify if the shell parsed the case statement 300+ times, I
tried separating each test group into a shell function. That moved the
parsing from happening "after writing the heading" to "before writing
the heading", but it did not speed up the testsuite at all (it actually
lost 1-2%).
I attach the patch for the sake of your experimenting.
Paolo
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index 31038a1..91aefa5 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -119,6 +119,7 @@ m4_define([_m4_divert(HELP_END)], 304)
m4_define([_m4_divert(VERSION)], 350)
m4_define([_m4_divert(VERSION_NOTICES)], 351)
m4_define([_m4_divert(VERSION_END)], 352)
+m4_define([_m4_divert(TEST_FUNCTIONS)], 399)
m4_define([_m4_divert(PREPARE_TESTS)], 400)
m4_define([_m4_divert(TESTS)], 401)
m4_define([_m4_divert(TESTS_END)], 402)
@@ -1198,8 +1199,10 @@ m4_define([AT_xfail], [at_xfail=no])
m4_define([AT_description], m4_quote($1))
m4_define([AT_ordinal], m4_incr(AT_ordinal))
m4_append([AT_groups_all], [ ]m4_defn([AT_ordinal]))
-m4_divert_push([TESTS])dnl
- AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): m4_defn([AT_description])
+m4_divert_push([TEST_FUNCTIONS])dnl
+
[EMAIL PROTECTED]:@ AT_ordinal. m4_defn([AT_line]): m4_defn([AT_description])
+at_test[]AT_ordinal () {
at_setup_line='m4_defn([AT_line])'
at_desc="AS_ESCAPE(m4_defn([AT_description]))"
$at_quiet AS_ECHO_N(["m4_format([%3d: ], AT_ordinal)$at_desc"]dnl
@@ -1247,7 +1250,7 @@ m4_define([AT_CLEANUP],
[m4_append([AT_help_all],
m4_defn([AT_ordinal]);m4_defn([AT_line]);m4_defn([AT_description]);m4_ifdef([AT_keywords],
[m4_defn([AT_keywords])]);
)dnl
-m4_divert_pop([TEST_SCRIPT])dnl Back to TESTS
+m4_divert_pop([TEST_SCRIPT])dnl Back to TESTS_FUNCTIONS
AT_xfail
echo "# -*- compilation -*-" >> "$at_group_log"
(
@@ -1258,8 +1261,10 @@ m4_undivert([TEST_SCRIPT])dnl Insert the code here
$at_times_p && times >"$at_times_file"
) AS_MESSAGE_LOG_FD>&1 2>&1 | eval $at_tee_pipe
at_status=`cat "$at_status_file"`
- ;;
-
+}
+m4_divert_pop([TEST_FUNCTIONS])dnl Back to KILL
+m4_divert_push([TESTS])dnl
+ AT_ordinal ) at_test[]AT_ordinal ;;
m4_divert_pop([TESTS])dnl Back to KILL.
])# AT_CLEANUP