how can I speed up latexmk (sagetex) on a Mac?

asked 2016-08-06 22:18:23 -0600

I'm running latexmk on a Mac with sage 7.2 installed.

I'm confused about why the compilation process with tex files that use sagetex seem to take either 15-20 seconds or less than a second. I understand that there may be previously-generated files (plots, etc), but I have controlled for that by removing those files before each compilation.

Is there any way I can get consistent (and hopefully fast) compile times for my sagetex documents?

edit retag flag offensive close merge delete

Comments

I think in this case we would really need to see a minimal example that is "too long". I will say that from my experience using SageTeX, if Sage needs to start fresh, it takes quite a while, and then following ones much less time (which is true of anything you do with Sage). Can you give more details about your exact workflow? (E.g., do you use the Sage engine in TeXShop - I guess not, if you use a different maker?)

kcrisman gravatar imagekcrisman ( 2016-08-08 10:40:20 -0600 )edit

My workflow comes in two cases:

FIRST: I use Sublime text editor on my Mac to write LaTeX code with embedded sage (\sage, \sagesilent, \sageplot, etc.) The build system in Sublime allows me to run the following latexmk command: "command": ["latexmk", "-cd", "-e", "$pdflatex = '%E -shell-escape -interaction=nonstopmode -synctex=1 %S %O'", "-f", "-pdf"]

I also have a latexmkrc file with this: add_cus_dep('sage', 'sout', 0, 'makesout'); $hash_calc_ignore_pattern{'sage'} = '^( _st_.goboom|print .SageT)'; sub makesout { system("/Applications/sage_72/sage '$_[0].sage'"); }

SECOND: I have a Mongo database with many individual latex snippets that are sorted by keyword. I have a python script that pulls each of these snippets out, builds a small tex file, then runs latexmk.

crucalculus gravatar imagecrucalculus ( 2016-08-10 08:12:36 -0600 )edit

I apologize for the reference to "too long"

In reality, it really isn't that big of a deal. I'm just a little confused about why sage can take such varied amounts of time to do essentially the same task. I've done some research, but can't figure out exactly what's happening.

crucalculus gravatar imagecrucalculus ( 2016-08-10 08:14:09 -0600 )edit

Hmm, that workflow is not part of my experience, so I don't know if that would have something to do with it. My only comment is my first one (if you haven't used Sage in a bit then it takes longer to load up) and that usually, in a tex-sage-tex flow the second tex call takes much less time - but consistently, presumably because some aux file is happy?

kcrisman gravatar imagekcrisman ( 2016-08-10 10:16:42 -0600 )edit