groupthm: speedup caching

replacing # in cached expressions only
    when necessary speeds up usage
This commit is contained in:
Maximilian Keßler 2022-02-03 14:26:14 +01:00
parent 0981e3f2d7
commit 7fe4092d8e

View file

@ -2616,7 +2616,7 @@
% Cache this definition for re-runs of \LaTeX. % Cache this definition for re-runs of \LaTeX.
% %
% \begin{macrocode} % \begin{macrocode}
\@@_cache:n \@@_cache_slow:n
{ {
\csname @@_define_family_options:nnnn \endcsname { #1 } { #2 } { #3 } { #4 } \csname @@_define_family_options:nnnn \endcsname { #1 } { #2 } { #3 } { #4 }
} }
@ -2864,15 +2864,26 @@
% for details. % for details.
% %
% \begin{macrocode} % \begin{macrocode}
\cs_new:Npn \@@_cache:n #1 \cs_set_eq:NN \@@_cache:n \@@_cache_auxfile:n
{ % \end{macrocode}
\tl_set:Nn \l_tmpa_tl % \end{macro}
{ %
{ #1 } %
} %
\regex_replace_all:nnN { \cP\# } { \cO\# } \l_tmpa_tl % \begin{macro}{\@@_cache_slow:n}
\@@_cache_auxfile:V \l_tmpa_tl %
} %
%
% \begin{macrocode}
\cs_new:Npn \@@_cache_slow:n #1
{
\tl_set:Nn \l_tmpa_tl
{
{ #1 }
}
\regex_replace_all:nnN { \cP\# } { \cO\# } \l_tmpa_tl
\@@_cache_auxfile:V \l_tmpa_tl
}
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
@ -2889,7 +2900,7 @@
\tl_use:N \g_@@_lazy_document_tl \tl_use:N \g_@@_lazy_document_tl
} }
{ {
\cs_show:N \g_@@_lazy_auxfile_tl \exp_args:NNV \iow_now:Nn \l_my_iow \g_@@_lazy_auxfile_tl
\benchmark_once:n \benchmark_once:n
{ {
\tl_use:N \g_@@_lazy_auxfile_tl \tl_use:N \g_@@_lazy_auxfile_tl