Uploaded image for project: 'Zeppelin'
  1. Zeppelin
  2. ZEPPELIN-1894

Matplotlib is very slow in python interpreter

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.7.0
    • 0.7.1, 0.8.0
    • None
    • None

    Description

      The following code takes 20 seconds in zeppelin python interpreter. But it only take 1 second in jupyter.

      import matplotlib.pyplot as plt
      import numpy as np
      
      x = np.random.normal(0,1,1024)
      y = np.random.normal(0,1,1024)
      
      plt.scatter(x,y, s=25)
      plt.xlim((-2,2))
      plt.ylim((-2,2))
      

      It looks like most of the time is spent on sending image to client.

      DEBUG [2017-01-03 21:02:05,284] ({pool-2-thread-2} PythonInterpreter.java[sendCommandToPython]:248) - Sending :
      import matplotlib.pyplot as plt
      import numpy as np
      
      x = np.random.normal(0,1,1024)
      y = np.random.normal(0,1,1024)
      
      plt.scatter(x,y, s=25)
      plt.xlim((-2,2))
      plt.ylim((-2,2))
      z._displayhook()
      DEBUG [2017-01-03 21:02:05,507] ({pool-2-thread-2} PythonProcess.java[sendAndGetResult]:114) - Read line from python shell : <matplotlib.collections.PathCollection object at 0x106f5eb10>
      DEBUG [2017-01-03 21:02:05,532] ({pool-2-thread-2} PythonProcess.java[sendAndGetResult]:114) - Read line from python shell : (-2, 2)
      DEBUG [2017-01-03 21:02:05,557] ({pool-2-thread-2} PythonProcess.java[sendAndGetResult]:114) - Read line from python shell : (-2, 2)
      DEBUG [2017-01-03 21:02:05,557] ({pool-2-thread-2} PythonProcess.java[sendAndGetResult]:114) - Read line from python shell : %html
      DEBUG [2017-01-03 21:02:05,619] ({pool-2-thread-2} PythonProcess.java[sendAndGetResult]:114) - Read line from python shell : <div style='width:auto;height:auto'><img src=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlgAAAGQCAYAAAByNR6YAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAIABJREFUeJzsvX10XFd57/8djzU+9agXTAHHmLx45ER2pNFoHGJhglcTGWQUjxteTImjAdZiFegqK21viiXnxmNJIy4Jt782LeUPktWWdaGshEscTe4omcrtunF/rFxbWU1kYi7ppUkI...
      DEBUG [2017-01-03 21:02:05,620] ({pool-2-thread-2} PythonInterpreter.java[sendCommandToPython]:254) - Got :
      <matplotlib.collections.PathCollection object at 0x106f5eb10>
      (-2, 2)
      (-2, 2)
      %html..
      
      INFO [2017-01-03 21:02:19,754] ({pool-2-thread-2} SchedulerFactory.java[jobFinished]:137) - Job remoteInterpretJob_1483448524770 finished by scheduler org.apache.zeppelin.python.PythonInterpreter789681602
      

      Attachments

        Issue Links

          Activity

            People

              astroshim Shim HyungSung
              zjffdu Jeff Zhang
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: