%%
%% Copyright (c) 2022-2024 by Friedemann Bartels
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version.  The latest version of this license is in:
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% and version 1.3c or later is part of all distributions of
%% LaTeX version 2008/05/04 or later.
%%

%%
%% Benchmark 500 pages (average of the best 3 of at least 6 runs)
%% Commit    Date        TeX Live  CPU             Draft   Layouthelper  Total
%% 1.0.0                 2022      Apple M1  27.3s  21.3s  41.1s         89.7s
%% 1.0.3     2024/01/09  2023                28.4s  22.1s  42.2s         92.7s
%% 351dd838  2024/01/09                      28.8s  22.6s  42.6s         94.0s
%% 1.1.0     2024/01/17                      29.9s  22.6s  42.7s         94.2s
%%

\documentclass[gutter=10mm]{pagelayout}

\nocuttingmarks
% \safezone\grid\placeholders
\newtemplate{testtemplate}{
  \setgrid{
    {[1]{1}{2}{4}{8}{16}}
    {[2]{1}{2}{4}{8}{16}}
    {[4]{2}{1}{4}{8}{16}}
    {[8]{2}{1}{4}{8}{16}}
    {[16]{2}{1}{4}{8}{16}}
  }
  \placeholder{0 0 1 1}
  \placeholder{0 1 1 2}
  \placeholder{0 2 1 3}
  \placeholder{1 0 2 1}
  \placeholder{1 1 2 2}
  \placeholder{1 2 2 3}
  \placeholder{2 0 3 1}
  \setborder[width=1mm]{}
  \placeholder{2 1 3 2}
  \placeholder{2 2 3 3}
  \placeholder{4 4 5 5}
}

\newcount\pages
\pages=500

\begin{document}

  \loop
    \template{testtemplate}{
      \graphic{1x1}
      \graphic{2x1}
      \graphic[scale=2]{3x2}
      \graphic{1x2}
      \graphic{1x1}
      \graphic{2x1}
      \graphic[scale=2]{2x3}
      \graphic{1x2}
      \graphic[scale=2]{1x1}
    }
    \advance\pages by -1
  \ifnum \pages>0
  \repeat

\end{document}
