13

I have an old and slow computer and long LaTeX files. When typing I prefer to use \frac 1{x} instead of \frac{1}{x} or x_i instead of x_{i}.

Does the presence or omission of curly braces in these instances affect the compilation time in any way? If so in which way?

  • 3
    Well to begin with, x_mn is not the same as x_{mn} but with regards to the compilation I cannot say much. – azetina Jan 21 '14 at 15:32
  • 3
    A simple experiment using time with and without braces for 60 simple expressions shows that the real and user times increase with braces (from 0.195s to 0.210s and from 0.176s to 0.188s). The sys time remains equal (0.020s). – Gonzalo Medina Jan 21 '14 at 15:36
  • 3
    I would guess the answer is "yes they do, but not by any appreciable amount". One way to test would be using the PGF benchmarking library. – Hammerite Jan 21 '14 at 15:36
  • 9
    The version without the braces are an (unreported) syntax error, so you shouldn't use those. The time differences are likely to be orders of magnitute less than the time taken to post the question:-) See tex.stackexchange.com/questions/82329/… – David Carlisle Jan 21 '14 at 16:30
  • 9
    I tried typesetting $\frac12$ one million times getting a user time of 8.69 seconds, while $\frac{1}{2}$ the same number of times takes 8.81 seconds. This is what I call a negligible difference; the latter syntax is clearer. – egreg Jan 23 '14 at 11:37
14

The version without the braces is processed a tiny bit faster than the version with braces. Typesetting one million times $\frac12$ required 8.69 seconds, while a million $\frac{1}{2}$ took 8.81 seconds. This is what I call a negligible difference; the latter syntax is clearer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.