aboutsummaryrefslogtreecommitdiffstats
path: root/performance_check
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-11-25 19:16:00 +0100
committerJay Berkenbilt <ejb@ql.org>2022-11-25 19:17:15 +0100
commit3630a8c597a9abec853719b5cad176318a921bbf (patch)
tree8428010441cbbcd6e4918c4b2a4d2456682cd18c /performance_check
parent562ff1b6087a16a47ec5bc18fb765910541b1167 (diff)
downloadqpdf-3630a8c597a9abec853719b5cad176318a921bbf.tar.zst
Performance check: add test for extraction of single page
It is common to just read a few objects. Checking extraction of the first page exercises this to make sure we don't accidentally introduce a change that makes that case worse, such as adding an unnecessary traversal of the file, prematurely resolving objects we don't need, etc.
Diffstat (limited to 'performance_check')
-rwxr-xr-xperformance_check23
1 files changed, 19 insertions, 4 deletions
diff --git a/performance_check b/performance_check
index ac04d168..85ee658b 100755
--- a/performance_check
+++ b/performance_check
@@ -12,6 +12,8 @@ my $whoami = basename($0);
$| = 1;
# [ name, [ args ] ]
+# If <IN> appears, it is replaced with the input file name. Otherwise,
+# the input file name is added to the end of the arguments.
my @tests = (
['no arguments', []],
['generate object streams', ['--object-streams=generate']],
@@ -20,6 +22,7 @@ my @tests = (
['shared resource check', ['--split-pages', '--remove-unreferenced-resources=auto']],
['linearize', ['--linearize']],
['encrypt', ['--encrypt', 'u', 'o', '256', '--']],
+ ['extract first page', ['--empty', '--pages', '<IN>', '1', '--']],
['json-output', ['--json-output']],
['json-input', ['--json-input']],
);
@@ -214,7 +217,7 @@ sub filter_args
{
my $to_check = $arg;
$to_check =~ s/=.*$//;
- if (index($help, $to_check) == -1)
+ if (($to_check =~ m/^-/) && (index($help, $to_check) == -1))
{
my $new_arg = $arg_compat{$arg};
if (! defined $new_arg)
@@ -287,15 +290,27 @@ sub run_test
my ($file, $args) = @_;
my $outfile = "out.pdf";
- foreach my $arg (@$args)
+ my $found_in = 0;
+ my @cmd = ($executable, @$report_mem);
+ for (@$args)
{
+ my $arg = $_;
if ($arg eq '--json-output')
{
$outfile = "out.json";
- last;
}
+ elsif ($arg eq '<IN>')
+ {
+ $found_in = 1;
+ $arg = $file;
+ }
+ push(@cmd, $arg);
+ }
+ if (! $found_in)
+ {
+ push(@cmd, $file);
}
- my @cmd = ($executable, @$args, @$report_mem, $file, "$workdir/$outfile");
+ push(@cmd, "$workdir/$outfile");
# Run once and discard to update caches
system("sync");
run_cmd(@cmd);