integrate benchmarking properly

This commit is contained in:
Maximilian Keßler 2022-02-03 15:02:50 +01:00
parent 7fe4092d8e
commit f80bd84852

View file

@ -5,7 +5,7 @@
\keepsilent
\usedir{tex/latex/mkessler/groupthm}
\askforoverwritefalse
\generate{\file{groupthm.sty}{\from{groupthm.dtx}{package}}}
\generate{\file{groupthm.sty}{\from{groupthm.dtx}{package,benchmark}}}
\def\tmpa{plain}
\ifx\tmpa\fmtname\endgroup\expandafter\bye\fi
\endgroup
@ -836,6 +836,9 @@
% \begin{macrocode}
\RequirePackage{amsthm}
\RequirePackage{thmtools}
%<*benchmark>
\RequirePackage{l3benchmark}
%</benchmark>
\RequirePackage{l3keys2e}
% \end{macrocode}
%
@ -2782,12 +2785,18 @@
% \begin{macrocode}
\hook_gput_code:nnn { enddocument } { groupthm }
{
%<*benchmark>
\@@_benchmark_once:nn
{
Benchmarking ~ writing ~ to ~ auxfile:
}
{
%</benchmark>
% \end{macrocode}
% First, perform the regular dump:
% \begin{macrocode}
\clist_map_function:NN \g_@@_dump_auxfile_clist
\_@@_write_auxout:n
\clist_map_function:NN \g_@@_dump_auxfile_clist
\_@@_write_auxout:n
% \end{macrocode}
% Now, we want to dump the cached clist, but wrap it into the
% the corresponding macro call for storing it in
@ -2795,22 +2804,24 @@
% For this, we have to put two single braces into the auxfile
% separately
% \begin{macrocode}
\_@@_write_auxout:n
{
\csname tl_gput_right:cn \endcsname
{
g_@@_lazy_auxfile_tl
}
}
\_@@_write_auxout:x { \str_use:N \c_left_brace_str }
\_@@_write_auxout:n
{
\csname tl_gput_right:cn \endcsname
{
g_@@_lazy_auxfile_tl
}
}
\_@@_write_auxout:x { \str_use:N \c_left_brace_str }
% \end{macrocode}
% Now, dump the list
% \begin{macrocode}
\clist_map_function:NN \g_@@_dump_cache_clist
\_@@_write_auxout:n
\_@@_write_auxout:x { \str_use:N \c_right_brace_str }
\clist_map_function:NN \g_@@_dump_cache_clist
\_@@_write_auxout:n
\_@@_write_auxout:x { \str_use:N \c_right_brace_str }
%<*benchmark>
}
%</benchmark>
}
% \end{macrocode}
@ -2897,14 +2908,30 @@
\int_compare:nNnTF
\g_@@_cache_version_aux_int < \g_@@_cache_version_document_int
{
%<*benchmark>
\@@_benchmark_once:nn
{
Benchmarking ~ declarations ~ of ~ theorems ~ from ~ document:
}
{
%</benchmark>
\tl_use:N \g_@@_lazy_document_tl
%<*benchmark>
}
%</benchmark>
}
{
\exp_args:NNV \iow_now:Nn \l_my_iow \g_@@_lazy_auxfile_tl
\benchmark_once:n
{
\tl_use:N \g_@@_lazy_auxfile_tl
}
%<*benchmark>
\@@_benchmark_once:nn
{
Benchmarking ~ declarations ~ of ~ theorems ~ from ~ aux ~ file:
}
{
%</benchmark>
\tl_use:N \g_@@_lazy_auxfile_tl
%<*benchmark>
}
%</benchmark>
}
}
% \end{macrocode}
@ -2962,11 +2989,29 @@
%
%
%
% \subsection{Benchmarking}
%
% Just some utility macro for benchmarking
% some parts of the package.
%
%
% \begin{macro}{\@@_benchmark:nn}
%
%
%
% \begin{macrocode}
%
%<*benchmark>
\cs_new:Npn \@@_benchmark_once:nn #1
{
\iow_term:n { [groupthm] ~ #1 }
\iow_log:n { [groupthm] ~ #1 }
\benchmark_once:n
}
%</benchmark>
% \end{macrocode}
% \end{macro}
%
%
%
%
% \begin{macrocode}