[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Omit parent key in tp/t test suite?
From: |
Gavin Smith |
Subject: |
Omit parent key in tp/t test suite? |
Date: |
Wed, 26 Oct 2022 12:47:56 +0100 |
Hello Patrice, what would you think about omitting the 'parent' pointers
in the test suite under tp/t? Here is the patch:
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index d5ca1e1359..6a585f1d4e 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -471,15 +471,14 @@ my @sections_keys = ('section_next', 'section_prev',
'section_up',
my @node_keys = ('node_next', 'node_prev', 'node_up', 'menus',
'associated_section', 'node_preceding_part');
my %avoided_keys_tree;
-my @avoided_keys_tree = (@sections_keys, @menus_keys, @node_keys, 'structure',
- 'menu_child', 'unit_next', 'directions', 'page_next', 'remaining_args');
+my @avoided_keys_tree = (@sections_keys, @menus_keys, @node_keys,
+ 'structure', 'menu_child', 'unit_next', 'directions', 'page_next',
+ 'remaining_args', 'parent');
foreach my $avoided_key(@avoided_keys_tree) {
$avoided_keys_tree{$avoided_key} = 1;
}
sub filter_tree_keys { [grep {!$avoided_keys_tree{$_}} ( sort keys %{$_[0]} )]
}
-#my @avoided_compare_tree = (@avoided_keys_tree, 'parent', 'node_tree');
-
my %avoided_keys_sectioning;
my @avoided_keys_sectioning = ('section_next', @contents_keys, @menus_keys,
@node_keys, 'menu_child', 'manual_content', 'toplevel_next');
These pointers generate a huge amount of non-human readable "fix up"
code from Data::Dumper, after the legible tree dump. Updating these test
results gets rid of these. For example:
@@ -154,29 +139,12 @@ $result_trees{'alias_table_command'} = {
}
}
],
- 'parent' => {},
'type' => 'before_node_section'
}
],
'type' => 'document_root'
};
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[0]{'args'}[0];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'parent'}
= $result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[0];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[0]{'parent'} =
$result_trees{'alias_table_command'}{'contents'}[0];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[1]{'parent'} =
$result_trees{'alias_table_command'}{'contents'}[0];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'args'}[0];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'parent'}
= $result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'args'}[0]{'parent'}
=
$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[0]{'contents'}[0]{'contents'}[0];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[0]{'contents'}[0];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[0];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[0]{'parent'}
= $result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[1]{'args'}[0];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[1]{'args'}[0]{'parent'}
=
$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[1];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'contents'}[1]{'parent'}
= $result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2];
$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'extra'}{'command_as_argument'}
=
$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0];
-$result_trees{'alias_table_command'}{'contents'}[0]{'contents'}[2]{'parent'} =
$result_trees{'alias_table_command'}{'contents'}[0];
-$result_trees{'alias_table_command'}{'contents'}[0]{'parent'} =
$result_trees{'alias_table_command'};
$result_texis{'alias_table_command'} = '@alias myalias = code
It also reduces the size of the distribution .tar.xz file (roughly from
5.2 MB to 4.9 MB), and saves 10s of MB when extracting and building.
It should also make the test suite run faster, due to less code being loaded
and parsed by Perl:
Before:
$ time make check
real 2m43.365s
user 2m27.531s
sys 0m13.236s
...
$ time make check
real 2m45.350s
user 2m27.508s
sys 0m13.864s
After:
$ time make check
...
real 2m37.472s
user 2m19.646s
sys 0m13.453s
$ time make check
...
real 2m41.970s
user 2m20.703s
sys 0m13.966s
(These times also include tp/tests, which is not affected by
this change.)
Testing an individual test file:
Before:
$ time perl -w t/converters_tests.t
...
real 0m5.692s
user 0m5.536s
sys 0m0.088s
$ time perl -w t/converters_tests.t
...
real 0m5.598s
user 0m5.474s
sys 0m0.104s
After:
$ time perl -w t/converters_tests.t
...
real 0m5.153s
user 0m4.947s
sys 0m0.105s
$ time perl -w t/converters_tests.t
...
real 0m5.029s
user 0m4.918s
sys 0m0.092s
This is about 5-10% quicker and may be more significant on systems
with slower storage devices and/or CPU's.
Do you have any thoughts or objections before I commit this?
- Omit parent key in tp/t test suite?,
Gavin Smith <=