about-mobility.tex /size: 7974 b    last modification: 2023-12-21 09:43
1% language=us
2
3\startcomponent about-mobility
4
5\environment about-environment
6
7\startchapter[title=Flash forward]
8
9\startsection[title=Introduction]
10
11At the 2013 \CONTEXT\ meeting in Breslov, Harald König has taken some of his
12gadgets with him and this time the target was to get \CONTEXT\ running on small
13devices, most noticeably a mobile phone. You may wonder what purpose this serves,
14but with such devices becoming more powerful each year, and desktops and laptops
15getting less popular, we might see the small devices taking their place.
16Especially when we can dock them in a cradle and connect them to a proper monitor
17and keyboard we might end up with universal devices. Combine that with projection
18on our retinas and less tactile input and it will be clear that we should at
19least look into this from the perspective of \TEX\ usage.
20
21\stopsection
22
23\startsection[title=The tests]
24
25We used five tests for measuring basic performance. Of course we made sure that
26binaries and resources were cached.
27
28Test 1 measures some basics, like typesetting a paragraph, flushing pages and
29loading a file. Because we do lots of pages we can also see if garbage collection
30is a problem.
31
32\typefile{pi-speed-1.tex}
33
34A normal \CONTEXT\ run is triggered with:
35
36\starttyping
37context speed-1
38\stoptyping
39
40but with
41
42\starttyping
43context --timing speed-1
44\stoptyping
45
46memory consumption is measured and one can generate a visual representation of
47this afterwards.
48
49\starttyping
50context --extra=timing speed-1
51\stoptyping
52
53We don't show them here, simply because we saw nothing exciting in the ones
54for these tests.
55
56The second test is rather stupid but it gives an indication of how efficient the
57base pagebuilder is:
58
59\typefile{pi-speed-2.tex}
60
61The numbers are normally 10 to 20 times more impressive than those for regular runs.
62
63Test three is a variation on test one but this time we avoid the file being read
64in many times, so we inline \type{ward.tex}. We also add no page breaks so we get
65less pages but with more content.
66
67\typefile{pi-speed-3.tex}
68
69The fourth test draws a few \METAPOST\ graphics, which themselves use a bit of
70typeset text.
71
72\typefile{pi-speed-4.tex}
73
74The last test, number five, is more demanding. Here we use some colors (which
75stresses the backend) and a dynamic switch to smallcaps, which puts a bit of a
76burden on the \OPENTYPE\ handler.
77
78\typefile{pi-speed-5.tex}
79
80\stopsection
81
82\startsection[title=Regular laptops]
83
84We started measuring on Haralds laptop, a Lenovo X201i, and got the following
85timings (that matched our expectations). The second column shows the runtime, the
86last column the pages per second.
87
88\starttabulate[|l|r|r|]
89\BC speed-1 \NC  5.8 \NC  17.1 \NC \NR
90\BC speed-2 \NC  3.6 \NC 275.6 \NC \NR
91\BC speed-3 \NC  5.1 \NC  19.8 \NC \NR
92\BC speed-4 \NC  0.6 \NC   1.8 \NC \NR
93\BC speed-5 \NC 11.9 \NC  10.6 \NC \NR
94\stoptabulate
95
96Just for comparison, as I'm wrapping this up in 2016, on my current Dell 7600 I
97get these timings (the last two columns are with \LUAJITTEX):
98
99\starttabulate[|l|r|r|r|r|]
100\BC speed-1 \NC  4.6 \NC  21.9 \NC 3.0 \NC  33.5 \NC \NR
101\BC speed-2 \NC  3.6 \NC 278.2 \NC 2.8 \NC 357.7 \NC \NR
102\BC speed-3 \NC  4.2 \NC  23.6 \NC 2,7 \NC  37.0 \NC \NR
103\BC speed-4 \NC  0.8 \NC   1.3 \NC 0.6 \NC   1.7 \NC \NR
104\BC speed-5 \NC  6.2 \NC  20.3 \NC 4.0 \NC  31.9 \NC \NR
105\stoptabulate
106
107These tests were run with a \LUATEX\ 0.98 and the most recent \CONTEXT\
108\OPENTYPE\ font processor. As we do more in \LUA\ that a few years back, one
109can't expect a much faster run, even when the Dell has a faster processor than
110the Lenovo. However, what gets noticed is that the fifth speed test runs about
111twice as fast which is mostly due to improvements in the handling of \OPENTYPE\
112features.
113
114\startsection[title=The Nexus IV]
115
116This mobile phone has a quad-core arm processor running at 1.5 GHz. With 2 Gb
117memory this should be sufficient for running \TEX. The operating system is
118Android, which means that some effort is needed to put \TEX\ with its resources
119on the internal flash disk. Access was remote from a laptop.
120
121\starttabulate[|l|r|r|]
122\BC speed-1 \NC 41.9 \NC  2.4 \NC \NR
123\BC speed-2 \NC 27.5 \NC 36.4 \NC \NR
124\BC speed-3 \NC 38.7 \NC  2.6 \NC \NR
125\BC speed-4 \NC  3.4 \NC  3.0 \NC \NR
126\BC speed-5 \NC 87.9 \NC  1.4 \NC \NR
127\stoptabulate
128
129So it looks like the phone runs these tests about five times slower than the
130laptop. The fifth test is most stressful on the hardware but as noted, a more
131recent \CONTEXT\ will give better times there due to improvements in feature
132processing.
133
134\stopsection
135
136\startsection[title=The Raspbery Pi]
137
138The Pi (we're talking of the first model here) has an extension bus and can be
139used to control whatever device, it has more the properties (and build) of a
140media player and indeed there are dedicated installations for that. But as this
141popular small device can host any \LINUX\ distribution this is what was done. The
142distribution of choice was OpenSuse. The setup was really experimental with an
143unboxed Pi, an unframed \LCD\ panel, a keyboard and mouse, a power supply and
144some wires to connect this all. With an ethernet cable running directly to the
145router a distribution could be fetched and installed.
146
147This device has a single core arm processor running at 700 Mhz with half a
148gigabyte of memory. Persistent memory is a flash card, not that fast but
149acceptable. The maximum read speed was some 20 MB per second. It was no real
150surprise that the set of tests ran much slower than on the phone.
151
152It took a bit of experimenting but a 200 Mhz overclock of the \CPU\ combined with
153overclocked memory made performance jump up. In fact, we got a speed that we
154could somehow relate to the phone that has a more modern \CPU\ and runs at 1.5
155times that speed.
156
157Being a regular \LINUX\ setup, installation was more straightforward than on the
158phone but of course it took a while before all was in place. The default clock
159timings are:
160
161\starttabulate[|l|r|r|]
162\BC speed-1 \NC  95.841 \NC  1.043 \NC \NR
163\BC speed-2 \NC  76.817 \NC 13.018 \NC \NR
164\BC speed-3 \NC  84.890 \NC  1.178 \NC \NR
165\BC speed-4 \NC  13.241 \NC  0.076 \NC \NR
166\BC speed-5 \NC 192.288 \NC  0.660 \NC \NR
167\stoptabulate
168
169Again, the main conclusion here is that documents that need lots of \OPENTYPE\
170feature juggling, this is not the best platform.
171
172\stopsection
173
174\startsection[title=Summary]
175
176We see small devices gaining more performance each iteration than larger
177machines. Their screens and input method also evolve at a higher speed. The
178question is if arm will keep dominating this segment, but at least it is clear
179that they are useable for \TEX\ processing. Keep in mind that we used \LUATEX,
180which means that we also have \LUA\ with its garbage collector. Add \CONTEXT\ to
181that, which is not that small and preloads quite some resources, and it will be
182clear that these devices actually perform quite well, given slower memory, slower
183disks, small caches etc. With down|-|scaled intel chips showing up it can only
184get better. Keep in mind that we only need one core, so the speed of one core
185matters more than having multiple cores available, although the other cores can
186be wasted on keeping up with your social demands on such a device in parallel
187with the \TEX\ run.
188
189A runtime five to ten times slower than a decent laptop is not something that we
190look forward to in a production environment, but when you're on the road it is
191quite okay, especially if it can replace a somewhat heavy portable workstation
192like we do. Okay, how much \TEX\ processing do you need when mobile, but still.
193As vendors of server hardware are looking into high density servers with lots of
194small fast processors, we might at some point actually use \TEX\ on such
195hardware. By then performance might be en par with virtual machines running on
196average loaded machines.
197
198We are pretty sure that on following \CONTEXT\ meetings more such experiments
199will be done so we'll keep you posted.
200
201\stopsection
202
203\stopchapter
204
205\stopcomponent
206