3
$\begingroup$

I have been trying to find out how much faster Mathematica is in CLI than in GUI, and with lack of success in finding any information about it, I decided to crowdsource my quest for this piece of hopefully useful nerdy knowledge.


I know that there exist methods for timing the evaluation of the notebook, but here arise my main two problems with timing:

  1. I started using Mathematica some six months ago, and I realise that I do not yet possess the knowledge and skills to truly test the speed differences in heavier processing. Henceforth, I could only time some relatively lighter processing, which would likely not produce any meaningful difference between the CLI and GUI (this would reflect my current usage, yes, but I would not learn nothing new for optimising processing for the future).
  2. Secondly, I am interested in finding out if the two interfaces use hardware differently, which trial-and-error type timing would not tell me. (E.g. does the CLI use the processing computer's processor (and its cores) more efficiently than the GUI, or do they use the same interface with comparable results?)

While the question admittedly is quite case-specific, I have a few more general questions about the two interfaces' computing speed differences. I know the CLI can be commanded to evaluate several notebooks at once, but thinking about single-notebook cases:

  • Is the CLI faster than the GUI in simpler cases (let's say; evaluation times of <5 seconds), or are the two generally speaking as fast?
  • Is the CLI faster than the GUI in more complex cases (let's say; evaluation times of ≥5 seconds), or are the two generally speaking as fast?
  • Does the CLI use hardware more efficiently than the GUI? Are there differences between the two when it comes to utilising multi-core processors?
  • Finally: In 2015, is there any and what are the reasons to use the CLI over the GUI (unless I want to play around with multiple notebooks at once)?

While it seems like a simple thing to search for, I could find any general results for the differences between the two, as the choice between using CLI or GUI seemed to come to people's preferences and the operating system in use.

$\endgroup$
8
  • 3
    $\begingroup$ There should not be any significant difference except as it concerns display and typesetting. Mathematica uses a client/server architecture, and the kernel is a completely separate process to the front end. To the extent that differences exist, it will be due to the terminal application being unable to produce graphical or typeset outputs. Your question is not very well-defined without reference to specific workloads, and your expectations that there could be a difference e.g. in multithreading efficiency do not seem justified by anything in particular. $\endgroup$ Jul 26, 2015 at 18:44
  • 1
    $\begingroup$ As I see it, the principal use case for the terminal application is on compute clusters where you are running batch jobs and do not have (or need) an interactive interface. $\endgroup$ Jul 26, 2015 at 18:48
  • $\begingroup$ Yeah, the cluster / remote operation of Mathematica naturally begs for the CLI, but your mention of Mathematica's client/server architecture makes sense and gives a good idea about if the interfaces true difference. $\endgroup$
    – V-J
    Jul 26, 2015 at 19:10
  • 1
    $\begingroup$ Reasons to use CLI: 1. run a script (non-interactive use) 2. run on a remote machine 3. see messages printed to the terminal (these might be printed by shared libraries you loaded into Mathematica). This is only for debugging very special cases. I almost always use the GUI version. Oleksandr already said that the kernel process that's being run is the same regardless of whether you run it with or without a front end (GUI). $\endgroup$
    – Szabolcs
    Jul 26, 2015 at 19:50
  • 1
    $\begingroup$ To really drive this point home, I wanted to mention that you can even start up a kernel in a terminal, use it for a while, and attach it to a front end (GUI) later! Finally: certain operations, such as rendering/exporting graphics, require a front end process. Even if you run Mathematica in a terminal, it will start up a front end process without any visible windows as soon as you try to export or rasterize graphics. $\endgroup$
    – Szabolcs
    Jul 26, 2015 at 19:51

0

Browse other questions tagged or ask your own question.