Slug #741

C5 GUI: slow to close

Added by John Abbott about 3 years ago. Updated 8 months ago.

Target version:
Start date:
26 Jun 2015
Due date:
% Done:


Estimated time:
2.75 h
Spent time:


The C5 GUI can be VERY slow to close (while making intensive use of the processor) in some circumstances.

Here is one way to observe the slowness:

Fact(100000); --> produces long output
L := 1..20000;
S := sorted(L);  --> takes several seconds, interrupt the computation using "stop" button

If you now decide to quit the C5 GUI by selecting "quit" from the "file" menu, it takes several minutes to close the window (blocking the cursor as a coloured wheel on MacOSX).

Related issues

Related to CoCoA-5 - Bug #1093: GUI: bugs and slugsNew2017-07-23


#1 Updated by John Abbott about 3 years ago

  • Priority changed from Normal to Low

The window closes quickly if you do not first compute (and print) Fact(100000).

Needs more investigation to discover what exactly is the cause.

Some more experiments:

Fact(100000);  -- SLOW

N:=Fact(100000); -- FAST
N;  -- SLOW
1; -- SLOW

At this point I am inclined to guess that the presence of a long line of output is what causes the slow closure.

#2 Updated by John Abbott about 3 years ago

The GUI is slow to close also after simply computing and printing (x+y+z+1)^99.

JAA think that this confirms that the slowness comes from having a long output line.

#3 Updated by John Abbott about 3 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

Closing is practically instant if I do first a "Clear output window" and then close the C5 GUI. This suggests that closing the GUI should probably call "clear output window" first, and then close.

I'll have a look at the code to see if this can be added quickly and easily.

Note: on my machine it took 60s of CPU to close the GUI when I had computed and printed factorial(100000)

#4 Updated by John Abbott about 3 years ago

Found this C5.C:931

    connect(this->clearOutputButton, SIGNAL(clicked()), this, SLOT(clearOutputWindow()));

#5 Updated by John Abbott about 3 years ago

In file C5.C:1000 there is a function MainWindow::closeEvent

JAA thinks that this is probably the function needing modification.

#6 Updated by John Abbott almost 3 years ago

  • % Done changed from 10 to 50

I've hacked the code to make a call to clearOutputWindow, and it now seems to close much faster (after printing factorial(100000)).

I had to make the mem fn clearOutputWindow public (previously it was private), and add a boolean arg to avoid asking the user for confirmation prior to closing the output window.

It compiles and runs for me. I'll check in soon; with luck we can test it on other platforms before releasing.

#7 Updated by John Abbott 12 months ago

  • Status changed from In Progress to Feedback
  • Assignee set to John Abbott
  • Target version changed from CoCoA-5.?.? to CoCoA-5.2.2
  • % Done changed from 50 to 90

#8 Updated by John Abbott 12 months ago

  • Related to Bug #1093: GUI: bugs and slugs added

#9 Updated by John Abbott 8 months ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100
  • Estimated time set to 2.75 h

I don't know who else can test this. I hardly ever use the GUI; does anyone else?

Also available in: Atom PDF