SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2k stars 362 forks source link

LatexTools basic and traditional builder invoke intel version of pdlatex/latexmk instead of apple silicon version from the new universal build in MacTex #1518

Open DocEpsilon opened 3 years ago

DocEpsilon commented 3 years ago

Hi!

I've just downloaded MacTeX 2021, which supports universal apps, for either Intel or native apple silicon ARM architectures. Compiling my projects from command line, the activity monitor now reports usage of the native apple silicon optimized code on my M1 apple silicon MacBook Pro. However, building from ST3 with Cmd-B the activity monitor still reports execution of the intel /x86 version.

I assume it has got to do with mother- and child-processes. Since ST3 is running in x86-arch with rosetta 2, which calls python/LaTeXTools also in intel/x86 it can in turn only call latex as an intel/x86 executable?

Comparing the two from command line: Running through rosetta 2 yields approximately a 13 % performance penalty in the case of an average sized paper.

Not a big deal, but maybe worthwhile reporting. Will LatexTools in ST4 have native support for apple silicon?

DocEpsilon commented 3 years ago

I've found a solution/workaround:

Using the command-keyword in the builder_settings like the following either in the local sublime-project file or in Preferences->Package Settings->LaTeXTools-> Settings - User

"builder_settings" : {
    "command" : ["env", "/usr/bin/arch", "-arm64", "latexmk", "-cd", "-f", "-%E", "-interaction=nonstopmode", "-synctex=1"]
}

prepends the latexmk-command with env /usr/bin/arch -arm64 and the latex/pdflatex/lualatex/bibtex/biber etc will be executed as the apple silicon binary variant.

In a large project with over 200 pages this was even 25% percent faster (30 seconds build-time, as opposed to 40 seconds with rosetta 2).

Prepending the latexmk-Command with env /usr/bin/arch -arm64 thoru