[latex3-commits] [git/LaTeX3-latex3-latex3] master: Correct the logic of how huge replications are handled in l3benchmark (3e06bb8)

Bruno Le Floch bruno at le-floch.fr
Wed May 9 01:19:41 CEST 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/3e06bb869bc288b44a6621e38d4c47d82ef264a3

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

commit 3e06bb869bc288b44a6621e38d4c47d82ef264a3
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Tue May 8 19:18:46 2018 -0400

    Correct the logic of how huge replications are handled in l3benchmark


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

3e06bb869bc288b44a6621e38d4c47d82ef264a3
 l3trial/l3benchmark/l3benchmark.dtx |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/l3trial/l3benchmark/l3benchmark.dtx b/l3trial/l3benchmark/l3benchmark.dtx
index 0cd2806..326730b 100644
--- a/l3trial/l3benchmark/l3benchmark.dtx
+++ b/l3trial/l3benchmark/l3benchmark.dtx
@@ -467,12 +467,12 @@ end
 %   |#2| to be run |#1| times, and store the result in the
 %   integer~|#3|.
 %
-%   If the number of copies required is large (here ${}>1024$), it may
-%   exhaust \TeX{}'s main memory. In that case, we replicate $1024$
-%   times less the code |\@@_replicate_kibi_fold:n {#1}|.  Of course the
-%   division by $1024$ rounds to an integer, so that step introduces a
-%   relative error of order $1/1000$, much less than many other sources
-%   of variability.
+%   If the number of copies required is large, defining \cs{@@_tmp:w}
+%   would exhaust \TeX{}'s main memory. In that case, we replicate
+%   $|#1|/5000$ times the given code before passing it to the main call
+%   to \cs{@@_tmp:w}.  Of course the division rounds to an integer, so
+%   that step introduces a relative error of order at most
+%   $5000/500000$, less than many other sources of variability.
 %
 %   We subtract the time for another call to \cs{@@_tmp:w}, with the
 %   same arguments (to capture the time it takes to read the argument)
@@ -481,14 +481,15 @@ end
 \cs_new_eq:NN \@@_tmp:w ?
 \cs_new_protected:Npn \@@_raw_replicate:nnN #1
   {
-    \int_compare:nNnTF {#1} > { 1024 }
+    \int_compare:nNnTF {#1} > { 500000 }
       { \@@_raw_replicate_large:nnN {#1} }
       { \@@_raw_replicate_small:nnN {#1} }
   }
 \cs_new_protected:Npn \@@_raw_replicate_large:nnN #1#2
   {
-    \exp_args:Nno \@@_raw_replicate:nnN { #1 / 1024 }
-      { \@@_replicate_kibi_fold:n {#2} }
+    \cs_set:Npx \@@_tmp:w ##1 { \prg_replicate:nn { 5000 } {##1} }
+    \exp_args:Nno \@@_raw_replicate:nnN { #1 / 5000 }
+      { \@@_tmp:w {#2} }
   }
 \cs_new_protected:Npn \@@_raw_replicate_small:nnN #1#2
   {
@@ -501,9 +502,8 @@ end
   {
     \@@_raw:nN { \@@_tmp:w { } {#2} } \g_@@_time_int
     \int_gset:Nn #3 { #1 - \g_@@_time_int }
+    \cs_set_eq:NN \@@_tmp:w \prg_do_nothing:
   }
-\cs_new:Npx \@@_replicate_kibi_fold:n #1
-  { \prg_replicate:nn {1024} {#1} }
 %    \end{macrocode}
 % \end{macro}
 %





More information about the latex3-commits mailing list