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

Printing long strings is very slow in the python interpreter

    XMLWordPrintableJSON

Details

    Description

      Printing really long strings is very slow:

      s = 's'*100000
      

      This is particularly the case for the python interpreter:
      https://puu.sh/qLHA7/0a5f2ac5b3.png

      The pyspark interpreter is much better:
      https://puu.sh/qLI9x/1ae5cc4e18.png

      But this is still very slow compared to running the command in an actual python shell, which takes just a few milliseconds.

      This is a very relevant issue for matplotlib integration (ZEPPELIN-1344), which requires us to express raster images as a byte array if we wish to support inline plotting in a notebook. You can easily verify this by using z.show() with the python interpreter. For example, you may try:

      %python
      import matplotlib.pyplot as plt
      import numpy as np
      plt.contourf(np.random.random((100, 100)))
      z.show(plt)
      

      And notice that this will take a few minutes to run. This is because more complicated plots will require a greater number of characters to represent the image in byte string form.

      Attachments

        Issue Links

          Activity

            People

              astroshim Shim HyungSung
              agoodman Alex Goodman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: