Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Very (very very) slow typing for Mathematica in large cells.

362 views
Skip to first unread message

BernieTheJet

unread,
May 22, 2011, 6:55:56 AM5/22/11
to
I have some functions that are very long and complicated and which
take up many lines of a single cell. For one particularly long such
function it can take about 3 second for EACH new character that I type
to appear in the cell. What ends up happening is I go type a
sentence, wait a minute for it to appear on screen, then go back to do
whatever editing of my typos. Needless to say this is a bit
aggravating. I expect it is related to the various syntax checking
features that Mathematica now has. Features that I otherwise really like,
actually.

Does anyone know of any work around, or if this is only present on
WinXP? I have this problem in both 7 and 8.0.0, for both 32 and 64
bit windowz, I believe.

Cheers,

Bernard

István Zachar

unread,
May 23, 2011, 6:24:09 AM5/23/11
to
Dear Bernie,

the same performance drop is present under Win7 (64bit, Mathematica
8.0.1).
Even if you distribute your functions to separate cells, functional
programming is about feeding the result of a step directly to the
next, meaning that you might end up with a very complex program that
happens to take one single (though enormous) cell. For me, it usually
happens.
It would be nice to have a palette via the user can quickly switch
syntax coloring on/off for the given notebook. Once I've tried to do
this, though I ended up with a palette that switched off syntax
coloring for every open notebook except the one in focus. Anyone else
made more success?

Istvan


On May 22, 12:55 pm, BernieTheJet <berniethe...@gmail.com> wrote:
> I have some functions that are very long and complicated and which
> take up many lines of a single cell. For one particularly long such
> function it can take about 3 second for EACH new character that I type
> to appear in the cell. What ends up happening is I go type a
> sentence, wait a minute for it to appear on screen, then go back to do
> whatever editing of my typos. Needless to say this is a bit
> aggravating. I expect it is related to the various syntax checking

> features that Mathematica now has. Features that I otherwise really li=

Robert Rosenbaum

unread,
May 23, 2011, 6:27:44 AM5/23/11
to
(* Try surrounding the cell in comment symbols while you type, as I have done for this sentence. *)


Best,
Robert


On May 22, 2011, at 4:54 AM, BernieTheJet wrote:

> I have some functions that are very long and complicated and which
> take up many lines of a single cell. For one particularly long such
> function it can take about 3 second for EACH new character that I type
> to appear in the cell. What ends up happening is I go type a
> sentence, wait a minute for it to appear on screen, then go back to do
> whatever editing of my typos. Needless to say this is a bit
> aggravating. I expect it is related to the various syntax checking

> features that Mathematica now has. Features that I otherwise really like,

Albert Retey

unread,
May 23, 2011, 6:27:54 AM5/23/11
to
Hi,

> I have some functions that are very long and complicated and which
> take up many lines of a single cell. For one particularly long such
> function it can take about 3 second for EACH new character that I type
> to appear in the cell. What ends up happening is I go type a
> sentence, wait a minute for it to appear on screen, then go back to do
> whatever editing of my typos. Needless to say this is a bit
> aggravating. I expect it is related to the various syntax checking
> features that Mathematica now has. Features that I otherwise really like,
> actually.

That's of course a tremendous feature of Mathematica which tells you
that you should split up those monster cells :-)

> Does anyone know of any work around, or if this is only present on
> WinXP? I have this problem in both 7 and 8.0.0, for both 32 and 64
> bit windowz, I believe.

I'm also still using Mathematica on WindowsXP, but have never seen this
happen. Are you sure everything is o.k. with your installation? How
large are those cells, e.g. in number of lines? You can switch off the
syntax coloring completely or just some of it. If switching it off
completely helps you might want to experiment and see if you find a
particular setting that makes your notebooks react slow and just disable
that.

But honestly (and seriously) I would rather invest some time in
disentangling your functions. That would not only make the interface
more responsive but also ease (or probably even make possible) the
maintenance of that code. And - be sure I would give you a hard time if
you'd try to persuade me that your code is so special that this isn't
possible...

hth,

albert

David Bailey

unread,
May 23, 2011, 8:41:17 AM5/23/11
to
There was a slow typing bug at 8.0.0 that went away at 8.0.1, but I
think your problem is just that you are creating very large cells. The
real question is why you need to create such large cells. The only time
when I sometimes encounter this problem in a milder form, is when I
paste some output into an input cell. Normally I would only do that for
exploratory purposes.

I am not sure if this problem is even related to syntax colouring, as
there are also layout mechanisms operating that may become clumsy with
gigantic cells.

Tell us why you are creating such cells, and someone will offer a good
alternative.

David Bailey
http://www.dbaileyconsultancy.co.uk


BernieTheJet

unread,
May 24, 2011, 5:58:41 AM5/24/11
to
Thanks everyone. In fact Albert is right, I didn't think of trying to
shut off the syntax coloring. Doing so immediately solved the typing
delay. There are also a number of other such options that I switched
on and off in a Monte Carlo fashion, but none seemed to make any
serious difference.

Of course everyone's first inclination is to think that someone must
be doing something wrong to have such a big cell in the first place.
But, believe me, I do know better. I've looked at it and it comes out
to 29 pages and 67,000 characters just in that cell. I have been
ignoring this typing lag for a long time now, only forcing myself to
do something about it whenever it became too unbearable. So this
67,000 characters is already the result of many years of moving steps
into other functions. The rest of my code is about 300 pages long.

I think Istvan's suggestion is perhaps the best - it would be nice to
have a single drop-down check-mark in a menu for situations like this,
assuming of course that they can't just fix it. It amazes me that I
have a machine that can simulate nuclear explosions and launch
satellites, but which has trouble scanning text.

B


Peter Pein

unread,
May 24, 2011, 5:59:13 AM5/24/11
to
Am 23.05.2011 12:24, schrieb István Zachar:
> Dear Bernie,
>
> the same performance drop is present under Win7 (64bit, Mathematica
> 8.0.1).
not necessarily...
I've made a large output cell with "Expand[(1+x)^100] and entered "a+17
-mc^2" and every keystroke had an immediate effect.

This is Win7 HomePremium Sp1 64 Bit and Mathematica from February 2011
(8.0.1)

I tried it with Expand[(1+x)^1000] and got the same effect.

BernieTheJet

unread,
May 25, 2011, 5:57:46 AM5/25/11
to
Peter, this is a good idea with the Expand, and I tried it and I also
see no slow downs. So I expect that it has to do with nesting of
functions, so I try:

Fold[If[r > 1/2, Plus[#1, #2], Divide[#1, #2]] &, x, Range[11]]

which I then convert into a function:

f[x_,r_]:=...

This, then, has quite a few levels:

Depth[f[x,r]] -> 25

Here I definitely can observe the editing lag, although still not as
egregious as with my other work.

B


On May 24, 5:59 am, Peter Pein <pet...@dordos.net> wrote:
> Am 23.05.2011 12:24, schrieb Istv=E1n Zachar:> Dear Bernie,

0 new messages