[latex3-commits] [git/LaTeX3-latex3-latex3] master: Avoid some internal copies of \dimexpr by using public dim functions (76e9c6c)

Bruno Le Floch bruno at le-floch.fr
Mon Apr 2 05:03:53 CEST 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/76e9c6cbe8a632c369722f8ca30a04a2cc9e3c0b

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

commit 76e9c6cbe8a632c369722f8ca30a04a2cc9e3c0b
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Sun Apr 1 23:03:53 2018 -0400

    Avoid some internal copies of \dimexpr by using public dim functions
    
    And to allow \dim_to_decimal_in_sp:n to be used in l3fp, make it faster.


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

76e9c6cbe8a632c369722f8ca30a04a2cc9e3c0b
 l3kernel/l3candidates.dtx               |   18 ++----------------
 l3kernel/l3fp-aux.dtx                   |    4 +---
 l3kernel/l3fp-parse.dtx                 |    9 ++++-----
 l3kernel/l3skip.dtx                     |    2 +-
 l3kernel/testfiles/m3expl001.luatex.tlg |    3 ---
 l3kernel/testfiles/m3expl001.ptex.tlg   |    3 ---
 l3kernel/testfiles/m3expl001.tlg        |    3 ---
 l3kernel/testfiles/m3expl001.uptex.tlg  |    3 ---
 l3kernel/testfiles/m3expl001.xetex.tlg  |    3 ---
 l3kernel/testfiles/m3expl003.luatex.tlg |    3 ---
 l3kernel/testfiles/m3expl003.ptex.tlg   |    3 ---
 l3kernel/testfiles/m3expl003.tlg        |    3 ---
 l3kernel/testfiles/m3expl003.uptex.tlg  |    3 ---
 l3kernel/testfiles/m3expl003.xetex.tlg  |    3 ---
 14 files changed, 8 insertions(+), 55 deletions(-)

diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index 61504cd..dbfb360 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -1367,21 +1367,6 @@
 %<@@=coffin>
 %    \end{macrocode}
 %
-% \begin{macro}{\@@_dim_eval:w}
-% \begin{macro}{\@@_dim_eval:n}
-%   Evaluating a dimension expression expandably. The only
-%   difference with \cs{dim_eval:n} is the lack of \cs{dim_use:N}, to
-%   produce an internal dimension rather than expand it into characters.
-%    \begin{macrocode}
-\cs_new_eq:NN \@@_dim_eval:w \etex_dimexpr:D
-\__kernel_patch_args:nNNpn
-  { { \__kernel_chk_expr:nNnN {#1} \@@_dim_eval:w { } \@@_dim_eval:n } }
-\cs_new:Npn \@@_dim_eval:n #1
-  { \@@_dim_eval:w #1 \scan_stop: }
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
 % \subsubsection{Rotating coffins}
 %
 % \begin{variable}{\l_@@_sin_fp}
@@ -1472,8 +1457,9 @@
     \hbox_set:Nn \l_@@_internal_box
       {
         \tex_kern:D
-          \@@_dim_eval:n
+          \dim_eval:n
             { \l_@@_bounding_shift_dim - \l_@@_left_corner_dim }
+          \exp_stop_f:
         \box_move_down:nn { \l_@@_bottom_corner_dim }
           { \box_use:N #1 }
       }
diff --git a/l3kernel/l3fp-aux.dtx b/l3kernel/l3fp-aux.dtx
index 02e8f3d..c2775c6 100644
--- a/l3kernel/l3fp-aux.dtx
+++ b/l3kernel/l3fp-aux.dtx
@@ -65,14 +65,12 @@
 %
 % \subsection{Access to primitives}
 %
-% \begin{macro}
-%   {\@@_dim_eval:w, \@@_int_eval:w, \@@_int_eval_end:, \@@_int_to_roman:w}
+% \begin{macro}{\@@_int_eval:w, \@@_int_eval_end:, \@@_int_to_roman:w}
 %   Largely for performance reasons, we need to directly access primitives
 %   rather than use \cs{int_eval:n}. This happens \emph{a lot}, so we
 %   use private names. The same is true for \tn{romannumeral}, although it
 %   is used much less widely.
 %    \begin{macrocode}
-\cs_new_eq:NN \@@_dim_eval:w \etex_dimexpr:D
 \cs_new_eq:NN \@@_int_eval:w \etex_numexpr:D
 \cs_new_eq:NN \@@_int_eval_end: \scan_stop:
 \cs_new_eq:NN \@@_int_to_roman:w \tex_romannumeral:D
diff --git a/l3kernel/l3fp-parse.dtx b/l3kernel/l3fp-parse.dtx
index a58103f..c076294 100644
--- a/l3kernel/l3fp-parse.dtx
+++ b/l3kernel/l3fp-parse.dtx
@@ -840,7 +840,7 @@
 %   registers, the decimal rounding provided by \TeX{} does not
 %   accurately represent the binary value that it manipulates, so we
 %   extract this binary value as a number of scaled points with
-%   \cs{int_value:w} \cs{@@_dim_eval:w} \meta{decimal value} |pt|, and
+%   \cs{int_value:w} \cs{dim_to_decimal_in_sp:n} |{| \meta{decimal value} |pt| |}|, and
 %   use an auxiliary of \cs{dim_to_fp:n}, which performs the
 %   multiplication by $2^{-16}$, correctly rounded.
 %    \begin{macrocode}
@@ -885,7 +885,7 @@
   {
     \exp_after:wN \@@_from_dim_test:ww
     \int_value:w #2 \exp_after:wN ,
-    \int_value:w \@@_dim_eval:w #1 pt ;
+    \int_value:w \dim_to_decimal_in_sp:n { #1 pt } ;
   }
 %    \end{macrocode}
 %   The \tn{wd}, \tn{dp}, \tn{ht} primitives expect an integer argument.
@@ -905,8 +905,7 @@
   {
     \exp_after:wN \@@_from_dim_test:ww
     \exp_after:wN 0 \exp_after:wN ,
-    \int_value:w \@@_dim_eval:w
-      \exp_after:wN \use:n \exp_after:wN { \tex_the:D #1 #2 } ;
+    \int_value:w \dim_to_decimal_in_sp:n { #1 #2 } ;
   }
 %    \end{macrocode}
 % \end{macro}
@@ -2032,7 +2031,7 @@
       {
         \exp_after:wN \@@_from_dim_test:ww
         \exp_after:wN 0 \exp_after:wN ,
-        \int_value:w \@@_dim_eval:w 1 #1 \exp_after:wN ;
+        \int_value:w \dim_to_decimal_in_sp:n { 1 #1 } \exp_after:wN ;
         \exp:w \exp_end_continue_f:w \@@_parse_infix:NN
       }
   }
diff --git a/l3kernel/l3skip.dtx b/l3kernel/l3skip.dtx
index 79e812c..b47d2c8 100644
--- a/l3kernel/l3skip.dtx
+++ b/l3kernel/l3skip.dtx
@@ -1689,7 +1689,7 @@
 \__kernel_patch_args:nNNpn
   { { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \dim_to_decimal_in_sp:n } }
 \cs_new:Npn \dim_to_decimal_in_sp:n #1
-  { \int_eval:n { \@@_eval:w #1 \@@_eval_end: } }
+  { \int_value:w \@@_eval:w #1 \@@_eval_end: }
 %    \end{macrocode}
 % \end{macro}
 %
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index e02bde2..37b3488 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -3698,7 +3698,6 @@ Defining message LaTeX/kernel/nested-choice-key on line ...
 Defining message LaTeX/kernel/value-forbidden on line ...
 Defining message LaTeX/kernel/value-required on line ...
 Defining message LaTeX/kernel/show-key on line ...
-Defining \__fp_dim_eval:w on line ...
 Defining \__fp_int_eval:w on line ...
 Defining \__fp_int_eval_end: on line ...
 Defining \__fp_int_to_roman:w on line ...
@@ -5683,8 +5682,6 @@ Defining \clist_rand_item:n on line ...
 Defining \__clist_rand_item:nn on line ...
 Defining \clist_rand_item:N on line ...
 Defining \clist_rand_item:c on line ...
-Defining \__coffin_dim_eval:w on line ...
-Defining \__coffin_dim_eval:n on line ...
 Defining \l__coffin_sin_fp on line ...
 Defining \l__coffin_cos_fp on line ...
 Defining \l__coffin_bounding_prop on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 358f3c4..c6bbe6c 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -3635,7 +3635,6 @@ Defining message LaTeX/kernel/nested-choice-key on line ...
 Defining message LaTeX/kernel/value-forbidden on line ...
 Defining message LaTeX/kernel/value-required on line ...
 Defining message LaTeX/kernel/show-key on line ...
-Defining \__fp_dim_eval:w on line ...
 Defining \__fp_int_eval:w on line ...
 Defining \__fp_int_eval_end: on line ...
 Defining \__fp_int_to_roman:w on line ...
@@ -5622,8 +5621,6 @@ Defining \clist_rand_item:n on line ...
 Defining \__clist_rand_item:nn on line ...
 Defining \clist_rand_item:N on line ...
 Defining \clist_rand_item:c on line ...
-Defining \__coffin_dim_eval:w on line ...
-Defining \__coffin_dim_eval:n on line ...
 Defining \l__coffin_sin_fp on line ...
 Defining \l__coffin_cos_fp on line ...
 Defining \l__coffin_bounding_prop on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 6f8dfe4..b3c9392 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -3635,7 +3635,6 @@ Defining message LaTeX/kernel/nested-choice-key on line ...
 Defining message LaTeX/kernel/value-forbidden on line ...
 Defining message LaTeX/kernel/value-required on line ...
 Defining message LaTeX/kernel/show-key on line ...
-Defining \__fp_dim_eval:w on line ...
 Defining \__fp_int_eval:w on line ...
 Defining \__fp_int_eval_end: on line ...
 Defining \__fp_int_to_roman:w on line ...
@@ -5622,8 +5621,6 @@ Defining \clist_rand_item:n on line ...
 Defining \__clist_rand_item:nn on line ...
 Defining \clist_rand_item:N on line ...
 Defining \clist_rand_item:c on line ...
-Defining \__coffin_dim_eval:w on line ...
-Defining \__coffin_dim_eval:n on line ...
 Defining \l__coffin_sin_fp on line ...
 Defining \l__coffin_cos_fp on line ...
 Defining \l__coffin_bounding_prop on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 64c4ffe..eb3b632 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -3635,7 +3635,6 @@ Defining message LaTeX/kernel/nested-choice-key on line ...
 Defining message LaTeX/kernel/value-forbidden on line ...
 Defining message LaTeX/kernel/value-required on line ...
 Defining message LaTeX/kernel/show-key on line ...
-Defining \__fp_dim_eval:w on line ...
 Defining \__fp_int_eval:w on line ...
 Defining \__fp_int_eval_end: on line ...
 Defining \__fp_int_to_roman:w on line ...
@@ -5620,8 +5619,6 @@ Defining \clist_rand_item:n on line ...
 Defining \__clist_rand_item:nn on line ...
 Defining \clist_rand_item:N on line ...
 Defining \clist_rand_item:c on line ...
-Defining \__coffin_dim_eval:w on line ...
-Defining \__coffin_dim_eval:n on line ...
 Defining \l__coffin_sin_fp on line ...
 Defining \l__coffin_cos_fp on line ...
 Defining \l__coffin_bounding_prop on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index ffaaff5..e7c0e63 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -3696,7 +3696,6 @@ Defining message LaTeX/kernel/nested-choice-key on line ...
 Defining message LaTeX/kernel/value-forbidden on line ...
 Defining message LaTeX/kernel/value-required on line ...
 Defining message LaTeX/kernel/show-key on line ...
-Defining \__fp_dim_eval:w on line ...
 Defining \__fp_int_eval:w on line ...
 Defining \__fp_int_eval_end: on line ...
 Defining \__fp_int_to_roman:w on line ...
@@ -5660,8 +5659,6 @@ Defining \clist_rand_item:n on line ...
 Defining \__clist_rand_item:nn on line ...
 Defining \clist_rand_item:N on line ...
 Defining \clist_rand_item:c on line ...
-Defining \__coffin_dim_eval:w on line ...
-Defining \__coffin_dim_eval:n on line ...
 Defining \l__coffin_sin_fp on line ...
 Defining \l__coffin_cos_fp on line ...
 Defining \l__coffin_bounding_prop on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index e02bde2..37b3488 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -3698,7 +3698,6 @@ Defining message LaTeX/kernel/nested-choice-key on line ...
 Defining message LaTeX/kernel/value-forbidden on line ...
 Defining message LaTeX/kernel/value-required on line ...
 Defining message LaTeX/kernel/show-key on line ...
-Defining \__fp_dim_eval:w on line ...
 Defining \__fp_int_eval:w on line ...
 Defining \__fp_int_eval_end: on line ...
 Defining \__fp_int_to_roman:w on line ...
@@ -5683,8 +5682,6 @@ Defining \clist_rand_item:n on line ...
 Defining \__clist_rand_item:nn on line ...
 Defining \clist_rand_item:N on line ...
 Defining \clist_rand_item:c on line ...
-Defining \__coffin_dim_eval:w on line ...
-Defining \__coffin_dim_eval:n on line ...
 Defining \l__coffin_sin_fp on line ...
 Defining \l__coffin_cos_fp on line ...
 Defining \l__coffin_bounding_prop on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 358f3c4..c6bbe6c 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -3635,7 +3635,6 @@ Defining message LaTeX/kernel/nested-choice-key on line ...
 Defining message LaTeX/kernel/value-forbidden on line ...
 Defining message LaTeX/kernel/value-required on line ...
 Defining message LaTeX/kernel/show-key on line ...
-Defining \__fp_dim_eval:w on line ...
 Defining \__fp_int_eval:w on line ...
 Defining \__fp_int_eval_end: on line ...
 Defining \__fp_int_to_roman:w on line ...
@@ -5622,8 +5621,6 @@ Defining \clist_rand_item:n on line ...
 Defining \__clist_rand_item:nn on line ...
 Defining \clist_rand_item:N on line ...
 Defining \clist_rand_item:c on line ...
-Defining \__coffin_dim_eval:w on line ...
-Defining \__coffin_dim_eval:n on line ...
 Defining \l__coffin_sin_fp on line ...
 Defining \l__coffin_cos_fp on line ...
 Defining \l__coffin_bounding_prop on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 6f8dfe4..b3c9392 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -3635,7 +3635,6 @@ Defining message LaTeX/kernel/nested-choice-key on line ...
 Defining message LaTeX/kernel/value-forbidden on line ...
 Defining message LaTeX/kernel/value-required on line ...
 Defining message LaTeX/kernel/show-key on line ...
-Defining \__fp_dim_eval:w on line ...
 Defining \__fp_int_eval:w on line ...
 Defining \__fp_int_eval_end: on line ...
 Defining \__fp_int_to_roman:w on line ...
@@ -5622,8 +5621,6 @@ Defining \clist_rand_item:n on line ...
 Defining \__clist_rand_item:nn on line ...
 Defining \clist_rand_item:N on line ...
 Defining \clist_rand_item:c on line ...
-Defining \__coffin_dim_eval:w on line ...
-Defining \__coffin_dim_eval:n on line ...
 Defining \l__coffin_sin_fp on line ...
 Defining \l__coffin_cos_fp on line ...
 Defining \l__coffin_bounding_prop on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 64c4ffe..eb3b632 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -3635,7 +3635,6 @@ Defining message LaTeX/kernel/nested-choice-key on line ...
 Defining message LaTeX/kernel/value-forbidden on line ...
 Defining message LaTeX/kernel/value-required on line ...
 Defining message LaTeX/kernel/show-key on line ...
-Defining \__fp_dim_eval:w on line ...
 Defining \__fp_int_eval:w on line ...
 Defining \__fp_int_eval_end: on line ...
 Defining \__fp_int_to_roman:w on line ...
@@ -5620,8 +5619,6 @@ Defining \clist_rand_item:n on line ...
 Defining \__clist_rand_item:nn on line ...
 Defining \clist_rand_item:N on line ...
 Defining \clist_rand_item:c on line ...
-Defining \__coffin_dim_eval:w on line ...
-Defining \__coffin_dim_eval:n on line ...
 Defining \l__coffin_sin_fp on line ...
 Defining \l__coffin_cos_fp on line ...
 Defining \l__coffin_bounding_prop on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index ffaaff5..e7c0e63 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -3696,7 +3696,6 @@ Defining message LaTeX/kernel/nested-choice-key on line ...
 Defining message LaTeX/kernel/value-forbidden on line ...
 Defining message LaTeX/kernel/value-required on line ...
 Defining message LaTeX/kernel/show-key on line ...
-Defining \__fp_dim_eval:w on line ...
 Defining \__fp_int_eval:w on line ...
 Defining \__fp_int_eval_end: on line ...
 Defining \__fp_int_to_roman:w on line ...
@@ -5660,8 +5659,6 @@ Defining \clist_rand_item:n on line ...
 Defining \__clist_rand_item:nn on line ...
 Defining \clist_rand_item:N on line ...
 Defining \clist_rand_item:c on line ...
-Defining \__coffin_dim_eval:w on line ...
-Defining \__coffin_dim_eval:n on line ...
 Defining \l__coffin_sin_fp on line ...
 Defining \l__coffin_cos_fp on line ...
 Defining \l__coffin_bounding_prop on line ...





More information about the latex3-commits mailing list