# [tex-live] strange discrepancy in running time of etex between TL2015 and TL2017

jfbu jfbu at free.fr
Wed Jul 26 22:00:30 CEST 2017

Hi,

I am ready to upload xint 1.2l to CTAN tonight, and although
I didn't expect much changes (this is mainly a maintenance
release), as part of my release routine
I ran some code from the user manual about pi via Machin formula
to compare execution time with 1.2k version. (I expected no big
change because I did not much modify the code base)

Let me point out that the matter here is not the code itself,
which is surely much improvable upon, for example by dropping
TeX altogether. I am just saying that to preventively dispel some
misinterpretations. I know how to improve the speed by a factor
5000 at least, if I really want.

I just take it as a benchmark test.

Procedure to follow:

1. grab xint.dtx from CTAN (currently 1.2k, in 2 or 3 days will be 1.2l)

http://mirrors.ctan.org/macros/generic/xint/xint.dtx

2. execute "etex xint.dtx" in some work repertory

Then you have all xint.sty etc.. files extracted

3. run in this work repertory the test file which I will indicate next via

"time etex testmachin.tex"

- with TL2017

- with TL2015

4. compare the timing result. On my Mac OS 10.9.5 I consistently get
on an iMac about 5 years old, around

- 6.5 seconds with TL2017

- 4.5 seconds with TL2015

on this test, but this is not the point here)

Now I have no idea why 4.5 seconds with TL2015 and 6.5 seconds with TL2017 !

This is, as explained above, with the exact same xint version.

xint has no dependencies on other macro packages. The only different
thing is the etex (pdfetex) binary.

Here is now the benchmark file, it is extracted from the user manual basically
(The user manual contains a much faster other algorithm for pi too. Just to
help dispel preventively some misinterpretations)

----
% save this as testmachin.tex
% Compile with e-TeX extensions enabled (etex, pdftex, ...)
\input xintfrac.sty
\input xintseries.sty
% pi = 16 Arctg(1/5) - 4 Arctg(1/239) (John Machin's formula)
\def\coeffarctg #1{\the\numexpr\ifodd#1 -1\else1\fi\relax/%
\the\numexpr 2*#1+1\relax [0]}%
\def\xa {1/25[0]}%
\def\xb {1/57121[0]}%
\def\Machin #1{%
\romannumeral0\expandafter\MachinA \expandafter
{\the\numexpr (#1+3)*5/7\expandafter}\expandafter
{\the\numexpr (#1+3)*10/45\expandafter}\expandafter
{\the\numexpr #1+3\expandafter}\expandafter
{\the\numexpr #1\relax }}%
\def\MachinA #1#2#3#4%
{\xinttrunc {#4}
{\xintSub
{\xintMul {16/5}{\xintFxPtPowerSeries {0}{#1}{\coeffarctg}{\xa}{#3}}}
{\xintMul {4/239}{\xintFxPtPowerSeries {0}{#2}{\coeffarctg}{\xb}{#3}}}%
}}%
\pdfresettimer
\fdef\Z {\Machin {1000}}
\odef\W {\the\pdfelapsedtime}
\message{\Z}
\message{computed in \xintRound {2}{\W/65536} seconds.}

\def\x{3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989}

\ifx\x\Z \message{OK}\else \ERROR\fi
\bye
----

As I don't trust enormously \pdfelapsedtime, I double check via the unix "time",
hence the "time etex testmachin.tex"

Let me repeat the question is not about xint from TL2015 versus xint from TL2017

We are testing here the very same xint. At my side, the development version
which I will upload later tonight. At your side currently the 1.2k version.

The only difference is in the pdfetex.

Now the timing difference appears very significative.

I take the liberty to alert you upon this because I initially could not understand
the former timings I had recorded as comments in my copy of the file,

this discrepancy is causing alarm on unsuspecting software developers and perhaps
someone will have an explanation

Perhaps my OS is relevant ? Mac OS X 10.9.5. This means that with
TL2017 I use the so-called darwinlegacy executable.

(because I have not had the time to compile myself the binaries).

I would appreciate if you could CC to my mail address
as I don't subscribe to the list.

My bet is that people not on darwinlegacy will not reproduce my findings.

Best,

Jean-Francois