7

Could (La)TeX processing be made faster by better exploiting the modern multicore processors, such as incorporating multithreading into one of the existing tex-processors?

If so, is there any ongoing effort towards this goal in any of the popular projects?

João Lourenço
  • 1,083
  • 9
  • 16
  • 2
    No and no unfortunately. Also TeX by design cannot be made to work in parallel mode since its page shipout is immediate such that you cannot determine the number of pages beforehand. – percusse Nov 08 '17 at 22:11
  • @percusse, I believe you are thinking about parallelising the processing of pages, which is hard because of the immediate shipout. But in line with this idea, I wonder if we could process different chapters (each starting in a new page) in parallel (possibly getting a wrong page numbering, to be fixed in the next iteration); or alternatievely if we could apply some loop or pipelining-like parallelism into the core. – João Lourenço Nov 08 '17 at 22:26
  • You can run different instances of TeX with single \input{} at each chapter and combine PDFs if that's what you are after. I don't know how to assign each process to a different core though. – percusse Nov 08 '17 at 22:51
  • 2
    Related: https://tex.stackexchange.com/questions/364324/how-to-build-with-multiple-cores-in-ubuntu-16-04-and-texstudio – egreg Nov 08 '17 at 23:19
  • See also https://tex.stackexchange.com/a/103574/5763 – Martin Schröder Nov 09 '17 at 16:27
  • 3
    Yes (it could be made faster) and no (there is no ongoing work towards this). For example, different paragraphs could be typeset in parallel (hyphenation and line-breaking) to determine the list of hboxes, then these boxes could be assembled into vlists and pages by the main thread. (Yes in some cases a paragraph can depend on previous ones such as with references, but there are standard ways of dealing with such that will lead to speedups in practice, such as backing up and retrying when that happens, or hints to the compiler as with \FloatBarrier in LaTeX.) – ShreevatsaR Nov 09 '17 at 16:35
  • 3
    In short, TeX was written in the light of Knuth's extensive knowledge and expertise with compilers as of the late 1970s, but a re-do in light of today's compiler techniques would definitely lead to significant improvements. Unfortunately, the number of people working at the level of the TeX engine is a handful; the TeX program's monolithic nature makes it hard for someone to get started understanding it, and most advanced TeX users gravitate towards becoming experts in the use of the TeX macro system instead of breaking apart and refactoring/rewriting the program. :-) – ShreevatsaR Nov 09 '17 at 16:38

0 Answers0