[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh441: Fewer arguments to \@@_initialize_single:NNn (9190d186)

PhelypeOleinik phelype.oleinik at latex-project.org
Thu Dec 17 23:25:18 CET 2020


Repository : https://github.com/latex3/latex2e
On branch  : hotfix/gh441
Link       : https://github.com/latex3/latex2e/commit/9190d18695db0d9cd6696a00fbe0256e3ed92417

>---------------------------------------------------------------

commit 9190d18695db0d9cd6696a00fbe0256e3ed92417
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Thu Dec 17 19:25:18 2020 -0300

    Fewer arguments to \@@_initialize_single:NNn
    
    the next and top-level token lists are used only once, so there is no gain in pre-expanding and passing as argument


>---------------------------------------------------------------

9190d18695db0d9cd6696a00fbe0256e3ed92417
 base/lthooks.dtx | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 00311ce5..6abc0b8b 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -2876,7 +2876,7 @@
 %  \end{macro}
 %
 % \begin{macro}[EXP]{\@@_if_label_case:nnnnn}
-%   To avoid doing the string comparison twice in \cs{@@_initialize_single:NNNNn}
+%   To avoid doing the string comparison twice in \cs{@@_initialize_single:NNn}
 %   (once with \cs{str_if_eq:nn} and again with \cs{@@_label_ordered:nn}),
 %   we use a three-way branching macro that will compare |#1| and |#2|
 %   and expand to \cs{use_i:nnn} if they are equal, \cs{use_ii:nn} if
@@ -2971,7 +2971,7 @@
 %    the sorting routine so we make a quick test for that and in that
 %    case just update \cs{@@~\meta{hook}} to hold the |top-level| and
 %    |next| code chunks. If there are code chunks we call
-%    \cs{@@_initialize_single:NNNNn} and pass to it ready made csnames
+%    \cs{@@_initialize_single:NNn} and pass to it ready made csnames
 %    as they are needed several times inside. This way we save a bit
 %    on processing time if we do that up front.
 %    \begin{macrocode}
@@ -3007,9 +3007,8 @@
 %    save the old code property list so that it can be restored later.
 %    \begin{macrocode}
             \prop_set_eq:Nc \l_@@_work_prop { g_@@_#1_code_prop }
-            \@@_initialize_single:ccccn
-              { @@~#1 } { @@_toplevel~#1 } { @@_next~#1 }
-              { g_@@_#1_labels_clist } {#1}
+            \@@_initialize_single:ccn
+              { @@~#1 } { g_@@_#1_labels_clist } {#1}
 %    \end{macrocode}
 %    For debug display we want to keep track of those hooks that
 %    actually got code added to them, so we record that in plist. We
@@ -3077,9 +3076,9 @@
 %  \end{macro}
 %
 %
-%  \begin{macro}{\@@_initialize_single:NNNNn,\@@_initialize_single:ccccn}
+%  \begin{macro}{\@@_initialize_single:NNn,\@@_initialize_single:ccn}
 %
-%    \cs{@@_initialize_single:NNNNn} implements the sorting of the code
+%    \cs{@@_initialize_single:NNn} implements the sorting of the code
 %    chunks for a hook and saves the result in the token list for fast
 %    execution (\verb=#4=). The arguments are \meta{hook-code-plist},
 %    \meta{hook-code-tl}, \meta{hook-top-level-code-tl},
@@ -3097,12 +3096,10 @@
 %    checking for, just in case}
 %
 %    ^^A #1 <- \@@~#1
-%    ^^A #2 <- \@@_toplevel~#1
-%    ^^A #3 <- \@@_next~#1
-%    ^^A #4 <- \g_@@_#1_labels_clist
-%    ^^A #5 <- #1
+%    ^^A #2 <- \g_@@_#1_labels_clist
+%    ^^A #3 <- #1
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_initialize_single:NNNNn #1#2#3#4#5
+\cs_new_protected:Npn \@@_initialize_single:NNn #1#2#3
   {
 %    \end{macrocode}
 %    Step T1: Initialize the data structure \ldots
@@ -3113,7 +3110,7 @@
 %
 %    Store the name of the hook:
 %    \begin{macrocode}
-    \tl_set:Nn \l_@@_cur_hook_tl {#5}
+    \tl_set:Nn \l_@@_cur_hook_tl {#3}
 %    \end{macrocode}
 %    
 %    We loop over the property list holding the code and record all
@@ -3153,7 +3150,7 @@
               { \prop_map_break: }
               { \@@_apply_label_pair:nnn {##1} {####1} }
               { \@@_apply_label_pair:nnn {####1} {##1} }
-                  {#5}
+                  {#3}
           }
       }
 %    \end{macrocode}
@@ -3181,7 +3178,7 @@
 %    
 %    \begin{macrocode}
     \tl_gclear:N #1
-    \clist_gclear:N #4
+    \clist_gclear:N #2
 %    \end{macrocode}
 %
 %    The whole loop combines steps T5--T7:
@@ -3197,7 +3194,7 @@
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
-        \@@_clist_gput:NV #4 \l_@@_front_tl
+        \@@_clist_gput:NV #2 \l_@@_front_tl
         \@@_debug:n{ \iow_term:x{Handled~ code~ for~ \l_@@_front_tl} }
 %    \end{macrocode}
 %
@@ -3250,13 +3247,13 @@
 %    change for a reversed hook (then |top-level| is the very first code
 %    chunk added).  The |next| code is always added last.
 %    \begin{macrocode}
-    \@@_tl_gput:Nn #1 {#2}
-    \tl_gput_right:Nn #1 {#3}
+    \exp_args:NNo \@@_tl_gput:Nn #1 { \cs:w @@_toplevel~#3 \cs_end: }
+    \tl_gput_right:No #1 { \cs:w @@_next~#3 \cs_end: }
   }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\cs_generate_variant:Nn \@@_initialize_single:NNNNn { cccc }
+\cs_generate_variant:Nn \@@_initialize_single:NNn { cc }
 %    \end{macrocode}
 %  \end{macro}
 %





More information about the latex3-commits mailing list.