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.
%
% \begin{macrocode}
\@@_cache:n
\@@_cache_slow:n
{
\csname @@_define_family_options:nnnn \endcsname { #1 } { #2 } { #3 } { #4 }
}
@ -2864,15 +2864,26 @@
% for details.
%
% \begin{macrocode}
\cs_new:Npn \@@_cache:n #1
{
\tl_set:Nn \l_tmpa_tl
{
{ #1 }
}
\regex_replace_all:nnN { \cP\# } { \cO\# } \l_tmpa_tl
\@@_cache_auxfile:V \l_tmpa_tl
}
\cs_set_eq:NN \@@_cache:n \@@_cache_auxfile:n
% \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\@@_cache_slow:n}
%
%
%
% \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{macro}
%
@ -2889,7 +2900,7 @@
\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
{
\tl_use:N \g_@@_lazy_auxfile_tl