I am working on an application where the user learns a topic by interacting with a chatbot. After the completion of the course, the user can generate a personalized notebook using their interaction with the chatbot. The book is generated by compiling user notes/questions using jinja2 to a templated tex files and then proceeding to compile the tex files on the server.
The first course I am releasing is on Python. The problem is: the coursebook is around 465 pages with image pngs, around 90 glossary terms using glossaries package, around 400 exercises using xsim, and even more minted syntax highlighting.
It's taking like 45 minutes to compile just the book without the user notes. I am using latexmk with xelatex to compile the book and using the tufte-book class.
These are some of the things, I have figured out that can possibly reduce the time.
- Using
frozencacheofmintedexercises - Using
z 0compression in theoutputdriveroption
Any other pointers to reduce the time? Ideally, I would like it to be compiled to under 5 minutes. But this seems impossible now.
Any help at all will be appreciated.
Edit 1
- Also found the idea of compiling on a ramdisk as shown in the answer interesting. Will try and check it out.
Edit 2
I have finally managed to lower the compilation time from over 40 minutes to 2 minutes.
- Replaced
xsimwithexercisepackage ( Reduced 20 minutes ) - Converted pngs with pdfs ( Reduced 10 minutes )
- Replaced
mintedwithlistingfor syntax highlighting. Although I liked minted much better. The compilation time with themintedpackage is around 12 minutes. - Ramdisk is an interestingly fast solution but creating a microservice based on it seems complex
pstrickspictures, precompile them usingstandaloneand only include the resulting PDF. – Skillmon Jan 21 '21 at 11:08xsavebox). – Skillmon Jan 21 '21 at 11:09convert file.png file.pdfshould work. Butsam2pcreates much smaller images. But it might need manual compiling as it is not distributed anymore. I would hope they include it in TeXLive in the future. – daleif Jan 21 '21 at 12:05I guess I have to make peace with the slower compilation and notifying users about their generated personalized book via email.
– Siddharth Kanungo Jan 22 '21 at 06:10xsimwere you using? – cgnieder Jan 22 '21 at 13:20Package: xsim 2020/01/16 v0.16a eXercise Sheets IMproved. Does the latest package compile faster? – Siddharth Kanungo Jan 22 '21 at 13:25exercisewill still be faster, though. You probably shouldn't update a single package in the middle of a project. That can cause more troubles than it solves – cgnieder Jan 22 '21 at 15:29tasksandxsim. – Siddharth Kanungo Jan 23 '21 at 12:07