context-performance.tex /size: 2984 b    last modification: 2020-07-01 14:35
1\usemodule[art-01,abr-01]
2
3\starttext
4
5\subject {About performance}
6
7If you use \PDFTEX, \XETEX\ and \LUATEX\ you will notice a difference in speed.
8Don't draw conclusions too easily from simple tests like:
9
10\starttyping
11\dorecurse{1000}{test\page}
12\stoptyping
13
14or (also tests the file system):
15
16\starttyping
17\dorecurse{1000}{\input tufte\blank}
18\stoptyping
19
20The wide engines \XETEX\ and \LUATEX\ have more work to do than \PDFTEX, because
21the input is \UTF\ and \UNICODE\ fonts are used. Of course running \PDFTEX\ on
22extensive \UTF\ input will compensate it a bit.
23
24Comparing \XETEX\ and \PDFTEX\ (using \MKII) and \LUATEX\ (using \MKIV) is kind
25of useless anyway because the \LUATEX\ with \MKIV\ combination is not only doing
26more advanced things, which costs time, but at the other hand has more efficient
27alternatives, like for instance using \MPLIB, which gains a lot.
28
29So, it's best to compare speeds with a mixed content document: multiple fonts,
30text and math, images, \METAPOST\ graphics, structural components, tables, etc.
31
32On the average \PDFTEX\ is the fastest, but offering less functionality, while
33\LUATEX\ with \MKIV\ is often faster than \XETEX\ with \MKII. On complex products
34like the \METAFUN\ manual or when processing complex \XML\ files a \LUATEX\ is
35much faster than a \PDFTEX\ run.
36
37There is some startup time involved which is normally not that much, and initial
38font loading is also not really a burden, but of course for a few page document
39it brings down the number of pages processed per second. Normalizing the input
40takes a bit but applying \OPENTYPE\ font features takes much more. If you find
41unacceptable bottlenecks just let me know (but better first check performance in
42the other engines). Of course inefficient coding of styles (massive font switches
43where a simple one could do) are no reason for a complaint. Keep in mind:
44flexibility comes at a price.
45
46A lot of time went into making sure that \CONTEXT\ runs efficiently on \LUATEX\
47and we keep improving the performance. This is not so much an engine issue but
48more one of the macro package. Of course what is true for \CONTEXT\ \MKIV\ can be
49different for other macro packages but comparing with them makes no sense because
50the differences in functionality.
51
52There are many features in \CONTEXT\ \MKIV\ that demand analysis of the text
53stream and when a spot is found where that feature has to be applied some actions
54takes place. Most such features don't have an impact on overall performance (due
55to the analysis) unless they are used. Of course font processing has the largest
56impact, but they are also the most flexible and extensible feature, especially
57when you use dynamic features. And font processing is always enabled. Speed has
58been improved over time and we're currently at a point that further speedup makes
59not much sense and would only make the code more complex. This is not to say that
60we cannot improve performance in the future.
61
62Hans Hagen \crlf Hasselt NL
63
64\stoptext
65