Repository: ipython/ipython

Issue:
Sluggish response and unexplained hangs in QTConsole
Stepes to reproduce:
1) plot a graphic, the plot appears and you get the prompt back immediately
3) quickly enter 1+<Enter>
4) there is a delay of 2-3 seconds in which everything stops, then you get the result.

This didn't happen in (much?) older versions. I use `ipython qtconsole  --pylab=inline` with git master 39ecc74. 

continues QTConsole regressions from #6726



Discussion:
Not for me on Linux :-) Are you using PyQt4 or PySide? Windows, Linux, Mac?

You're right, this is triggered for me by a function which outputs a plot and returns some data but it's not the plot alone that triggers it. but delay is definitely there for me tho like the kernel is still busy even after the last result has been returned. I'm on linux with pyqt4.

I'll update if I can isolate reproduce steps to share. thanks @ccordoba12

@ccordoba12 , I think I've found something related could you check if this reproduces for you?

```
import random
d={random.randint(1,1000000) for x in range(200000)}
```

followed by

```
d.<tab>
# or even
len(d)
```

either feel very sluggish to me in QTC compared with ipython in the terminal. I nevert noticed this happening with older versions. Do you see this too with git master?

Thanks for reproducible example. I can confirm the regression:
1. `d.<Tab>` takes between 2 and 8 secs in master.
2. `len(d)` takes between 4 and 20 secs to complete.

I bisected the thing and found that the regression was introduced in commit  de473a1cef96068c6ebd2f5f52e6c3152fbfd799 done by @minrk 


Resolving patch:
diff --git a/IPython/qt/console/frontend_widget.py b/IPython/qt/console/frontend_widget.py
--- a/IPython/qt/console/frontend_widget.py
+++ b/IPython/qt/console/frontend_widget.py
@@ -700,10 +700,20 @@ def clear_output(self):
     #---------------------------------------------------------------------------
     # 'FrontendWidget' protected interface
     #---------------------------------------------------------------------------
-
-    def _call_tip(self):
-        """ Shows a call tip, if appropriate, at the current cursor location.
+    
+    def _auto_call_tip(self):
+        """Trigger call tip automatically on open parenthesis
+        
+        Call tips can be requested explcitly with `_call_tip`.
         """
+        cursor = self._get_cursor()
+        cursor.movePosition(QtGui.QTextCursor.Left)
+        if cursor.document().characterAt(cursor.position()) == '(':
+            # trigger auto call tip on open paren
+            self._call_tip()
+    
+    def _call_tip(self):
+        """Shows a call tip, if appropriate, at the current cursor location."""
         # Decide if it makes sense to show a call tip
         if not self.enable_calltips or not self.kernel_client.shell_channel.is_alive():
             return False
@@ -785,7 +795,7 @@ def _document_contents_change(self, position, removed, added):
 
         document = self._control.document()
         if position == self._get_cursor().position():
-            self._call_tip()
+            self._auto_call_tip()
 
     #------ Trait default initializers -----------------------------------------
 


Test patch: