Using Mathematica's Front End on the Raspberry Pi is truly a test of one's patience. The most basic of notebooks become unresponsive after seemingly trivial additions to the notebook. Consider the following Cell

  StringJoin["!raspistill -n -t 5", Sequence @@ {
    " -w ", ToString@width, 
    " -h ", ToString@height,
    " -ISO ", ToString@ISO

    }, " -o -"],
 {{width, 600}, 200, 2592, 1},
 {{height, 400}, 200, 1944, 1},
 {{ISO, 200}, {100, 200, 400, 800}},


As I type this cell, the first several lines get displayed more-or-less as I type. By the time I get to the {{ISO, 200} ... portion of the cell, the notebook is fairly unresponsive, the CPU usage has jumped to 100% and I can get ahead of the display by a line or more.

I've noticed some marginal increase in responsiveness with these options:

SetOptions[EvaluationNotebook[], "ShowSyntaxStyles" -> False]
SetOptions[EvaluationNotebook[], "ShowCodeAssist" -> False]
$HistoryLength = 0;

If I start a new Cell, the responsiveness goes back to "normal". If I input the same text into a TextCell, the display keeps up with my typing.

As surreal as it sounds, writing code into a TextCell and then converting the cell to Input is faster than trying to do everything in an Input cell.

Does anyone have any suggestions on what other Options may be influencing the performance of Input Cells?

  • 3
    $\begingroup$ Mathematica on a Raspberry Pi is like a dancing bear. You should be amazed that it dances and not expect it to dance gracefully :D You might try writing your code in a code editor and pasting it into Mathematica. $\endgroup$ – m_goldberg Jul 11 '14 at 18:22
  • 2
    $\begingroup$ @m_goldberg Oh I agree entirely and this question should not be viewed as a gripe. I'm all for promoting M/RPi (W/RPi?) and my efforts at the moment are to find ways to make the front end as easy to use as possible. $\endgroup$ – bobthechemist Jul 11 '14 at 18:41

The most of processor time when the FrontEnd formats the content of a Cell is spent on the syntax highligting. Disabling this feature should help. If it is not sufficient then you should turn off automatic formatting completely by switching to "Code" cell style which is purely textual (even word wrapping is turned off). You can also create your own cell style where any formatting or syntax checking will be completely turned off. I think that such a style may be based on "Text" style by adding the Evaluatable -> True option.

  • $\begingroup$ I see some minor improvements with using the Code Cell format, but I think your edit of customizing the Text Cell is right on target. $\endgroup$ – bobthechemist Jul 11 '14 at 18:24
  • $\begingroup$ I believe there is straightforward way to create new style based on existing style but currently I cannot find an example. Inspecting the built-in stylesheets should give the answer. $\endgroup$ – Alexey Popkov Jul 11 '14 at 18:36

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.