[latex3-commits] [git/LaTeX3-latex3-latex3] master: Speed up int_step functions (4bfefc7)

Bruno Le Floch bruno at le-floch.fr
Sun Apr 29 22:35:27 CEST 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/4bfefc796be03c02a0156938ba46f408e41e04f1

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

commit 4bfefc796be03c02a0156938ba46f408e41e04f1
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Sun Apr 29 16:35:27 2018 -0400

    Speed up int_step functions
    
    It seems reasonable to use \__int_eval:w in these l3int functions.
    They are the bottleneck in some upcoming \seq_shuffle:N code.


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

4bfefc796be03c02a0156938ba46f408e41e04f1
 l3kernel/l3int.dtx                      |   26 ++++++++++++++------------
 l3kernel/testfiles/m3expl001.luatex.tlg |    2 +-
 l3kernel/testfiles/m3expl001.ptex.tlg   |    2 +-
 l3kernel/testfiles/m3expl001.tlg        |    2 +-
 l3kernel/testfiles/m3expl001.uptex.tlg  |    2 +-
 l3kernel/testfiles/m3expl001.xetex.tlg  |    2 +-
 l3kernel/testfiles/m3expl003.luatex.tlg |    2 +-
 l3kernel/testfiles/m3expl003.ptex.tlg   |    2 +-
 l3kernel/testfiles/m3expl003.tlg        |    2 +-
 l3kernel/testfiles/m3expl003.uptex.tlg  |    2 +-
 l3kernel/testfiles/m3expl003.xetex.tlg  |    2 +-
 11 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/l3kernel/l3int.dtx b/l3kernel/l3int.dtx
index 8cb5fde..308c8c3 100644
--- a/l3kernel/l3int.dtx
+++ b/l3kernel/l3int.dtx
@@ -1797,7 +1797,7 @@
 % \subsection{Integer step functions}
 %
 % \begin{macro}{\int_step_function:nnnN}
-% \begin{macro}{\@@_step:wwwN, \@@_step:NnnnN}
+% \begin{macro}{\@@_step:wwwN, \@@_step:NwnnN}
 % \begin{macro}{\int_step_function:nN}
 % \begin{macro}{\int_step_function:nnN}
 %   Before all else, evaluate the initial value, step, and final value.
@@ -1832,26 +1832,28 @@
 \cs_new:Npn \@@_step:wwwN #1; #2; #3; #4
   {
     \int_compare:nNnTF {#2} > \c_zero
-      { \@@_step:NnnnN > }
+      { \@@_step:NwnnN > }
       {
         \int_compare:nNnTF {#2} = \c_zero
           {
             \__kernel_msg_expandable_error:nnn
               { kernel } { zero-step } {#4}
-            \use_none:nnnn
+            \prg_break:
           }
-          { \@@_step:NnnnN < }
+          { \@@_step:NwnnN < }
       }
-      {#1} {#2} {#3} #4
+      #1 ; {#2} {#3} #4
+    \prg_break_point:
   }
-\cs_new:Npn \@@_step:NnnnN #1#2#3#4#5
+\cs_new:Npn \@@_step:NwnnN #1#2 ; #3#4#5
   {
-    \int_compare:nNnF {#2} #1 {#4}
-      {
-        #5 {#2}
-        \exp_args:NNf \@@_step:NnnnN
-          #1 { \int_eval:n { #2 + #3 } } {#3} {#4} #5
-      }
+    \if_int_compare:w #2 #1 #4 \exp_stop_f:
+      \prg_break:n
+    \fi:
+    #5 {#2}
+    \exp_after:wN \@@_step:NwnnN
+    \exp_after:wN #1
+    \int_value:w \@@_eval:w #2 + #3 ; {#3} {#4} #5
   }
 \cs_new:Npn \int_step_function:nN
   { \int_step_function:nnnN { 1 } { 1 } }
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 82dd809..1762238 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -1354,7 +1354,7 @@ Defining \int_do_while:nNnn on line ...
 Defining \int_do_until:nNnn on line ...
 Defining \int_step_function:nnnN on line ...
 Defining \__int_step:wwwN on line ...
-Defining \__int_step:NnnnN on line ...
+Defining \__int_step:NwnnN on line ...
 Defining \int_step_function:nN on line ...
 Defining \int_step_function:nnN on line ...
 Defining \int_step_inline:nn on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 5dc0865..171c10a 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -1352,7 +1352,7 @@ Defining \int_do_while:nNnn on line ...
 Defining \int_do_until:nNnn on line ...
 Defining \int_step_function:nnnN on line ...
 Defining \__int_step:wwwN on line ...
-Defining \__int_step:NnnnN on line ...
+Defining \__int_step:NwnnN on line ...
 Defining \int_step_function:nN on line ...
 Defining \int_step_function:nnN on line ...
 Defining \int_step_inline:nn on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 4abf80c..b3adb05 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -1352,7 +1352,7 @@ Defining \int_do_while:nNnn on line ...
 Defining \int_do_until:nNnn on line ...
 Defining \int_step_function:nnnN on line ...
 Defining \__int_step:wwwN on line ...
-Defining \__int_step:NnnnN on line ...
+Defining \__int_step:NwnnN on line ...
 Defining \int_step_function:nN on line ...
 Defining \int_step_function:nnN on line ...
 Defining \int_step_inline:nn on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 48c73c6..2a6bd95 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -1352,7 +1352,7 @@ Defining \int_do_while:nNnn on line ...
 Defining \int_do_until:nNnn on line ...
 Defining \int_step_function:nnnN on line ...
 Defining \__int_step:wwwN on line ...
-Defining \__int_step:NnnnN on line ...
+Defining \__int_step:NwnnN on line ...
 Defining \int_step_function:nN on line ...
 Defining \int_step_function:nnN on line ...
 Defining \int_step_inline:nn on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index b62b5f4..ce46cb3 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -1352,7 +1352,7 @@ Defining \int_do_while:nNnn on line ...
 Defining \int_do_until:nNnn on line ...
 Defining \int_step_function:nnnN on line ...
 Defining \__int_step:wwwN on line ...
-Defining \__int_step:NnnnN on line ...
+Defining \__int_step:NwnnN on line ...
 Defining \int_step_function:nN on line ...
 Defining \int_step_function:nnN on line ...
 Defining \int_step_inline:nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 82dd809..1762238 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -1354,7 +1354,7 @@ Defining \int_do_while:nNnn on line ...
 Defining \int_do_until:nNnn on line ...
 Defining \int_step_function:nnnN on line ...
 Defining \__int_step:wwwN on line ...
-Defining \__int_step:NnnnN on line ...
+Defining \__int_step:NwnnN on line ...
 Defining \int_step_function:nN on line ...
 Defining \int_step_function:nnN on line ...
 Defining \int_step_inline:nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 5dc0865..171c10a 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -1352,7 +1352,7 @@ Defining \int_do_while:nNnn on line ...
 Defining \int_do_until:nNnn on line ...
 Defining \int_step_function:nnnN on line ...
 Defining \__int_step:wwwN on line ...
-Defining \__int_step:NnnnN on line ...
+Defining \__int_step:NwnnN on line ...
 Defining \int_step_function:nN on line ...
 Defining \int_step_function:nnN on line ...
 Defining \int_step_inline:nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 4abf80c..b3adb05 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -1352,7 +1352,7 @@ Defining \int_do_while:nNnn on line ...
 Defining \int_do_until:nNnn on line ...
 Defining \int_step_function:nnnN on line ...
 Defining \__int_step:wwwN on line ...
-Defining \__int_step:NnnnN on line ...
+Defining \__int_step:NwnnN on line ...
 Defining \int_step_function:nN on line ...
 Defining \int_step_function:nnN on line ...
 Defining \int_step_inline:nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 48c73c6..2a6bd95 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -1352,7 +1352,7 @@ Defining \int_do_while:nNnn on line ...
 Defining \int_do_until:nNnn on line ...
 Defining \int_step_function:nnnN on line ...
 Defining \__int_step:wwwN on line ...
-Defining \__int_step:NnnnN on line ...
+Defining \__int_step:NwnnN on line ...
 Defining \int_step_function:nN on line ...
 Defining \int_step_function:nnN on line ...
 Defining \int_step_inline:nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index b62b5f4..ce46cb3 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -1352,7 +1352,7 @@ Defining \int_do_while:nNnn on line ...
 Defining \int_do_until:nNnn on line ...
 Defining \int_step_function:nnnN on line ...
 Defining \__int_step:wwwN on line ...
-Defining \__int_step:NnnnN on line ...
+Defining \__int_step:NwnnN on line ...
 Defining \int_step_function:nN on line ...
 Defining \int_step_function:nnN on line ...
 Defining \int_step_inline:nn on line ...





More information about the latex3-commits mailing list