Hello all,
I am working with text presentation in Glamour: the browser is used to show
the contents of code files. I noted that the time to display the contents
of a file (almost) exponentially grows with the size of the file. So,
performing tests on files of three different sizes, I obtain the following
response times (using Pharo profiler):
1000 lines     2s
2500 lines     11s
3500 lines     23s.
So thats quite lot for me where I occasionally have files with 2K lines and
I may need to browse their contents rapidly.
Running my test script with the profiler in Pharo, I get this tree. I see
that the message fromString: method is sent to Text class several times and
that takes about 96% of the time (in all test cases). Any hints on how to
reduce the number of times the method is invoked by glamour?
tx in advance,
Usman
Trace with 3.5K lines:
 - 23669 tallies, 23671 msec.
**Tree**
--------------------------------
Process: (40s)  516161536: nil
--------------------------------
100.0% {23669ms} GLMTabulator(GLMBrowser)>>openOn:with:
  100.0% {23667ms} GLMTabulator(GLMBrowser)>>openWith:
    100.0% {23667ms} GLMMorphicRenderer>>open:
      91.2% {21577ms} GLMMorphicWindowRenderer
class(GLMMorphicWidgetRenderer class)>>render:from:
        |91.2% {21577ms} GLMMorphicWindowRenderer>>render:
        |  72.3% {17122ms}
GLMSystemWindow(SystemWindow)>>addMorph:fullFrame:
        |    |72.3% {17122ms} PanelMorph>>adoptPaneColor:
        |    |  72.3% {17120ms} PanelMorph(Morph)>>adoptPaneColor:
        |    |    72.3% {17120ms} PanelMorph>>adoptPaneColor:
        |    |      72.3% {17120ms} PanelMorph(Morph)>>color:
        |    |        72.3% {17120ms} PanelMorph(Morph)>>changed
        |    |          72.3% {17120ms} PanelMorph(Morph)>>privateFullBounds
        |    |            72.3% {17120ms} PanelMorph(Morph)>>submorphBounds
        |    |              72.3% {17120ms}
LazyTabGroupMorph(Morph)>>fullBounds
        |    |                72.3% {17120ms}
LazyTabGroupMorph(Morph)>>doLayoutIn:
        |    |                  65.1% {15418ms} TableLayout>>layout:in:
        |    |                    |65.1% {15418ms}
TableLayout>>layoutTopToBottom:in:
        |    |                    |  65.1% {15418ms}
PanelMorph(Morph)>>layoutInBounds:
        |    |                    |    65.1% {15418ms}
PanelMorph(Morph)>>bounds:
        |    |                    |      65.1% {15418ms}
PanelMorph(Morph)>>position:
        |    |                    |        65.1% {15418ms}
PanelMorph(Morph)>>fullBounds
        |    |                    |          65.1% {15418ms}
PanelMorph(Morph)>>doLayoutIn:
        |    |                    |            65.1% {15418ms}
TableLayout>>layout:in:
        |    |                    |              65.1% {15418ms}
TableLayout>>layoutTopToBottom:in:
        |    |                    |                65.1% {15418ms}
GLMPluggableTextMorph(Morph)>>layoutInBounds:
        |    |                    |                  65.1% {15418ms}
GLMPluggableTextMorph(Morph)>>bounds:
        |    |                    |                    65.1% {15418ms}
GLMPluggableTextMorph(PluggableTextMorph)>>extent:
        |    |                    |                      65.1% {15414ms}
GLMTextMorphForEditView(TextMorph)>>extent:
        |    |                    |                        65.1% {15414ms}
GLMTextMorphForEditView(TextMorph)>>installEditorToReplace:
        |    |                    |                          65.1%
{15414ms} GLMSmalltalkEditor class(TextEditor class)>>forMorph:
        |    |                    |                            65.1%
{15414ms} GLMSmalltalkEditor(TextEditor)>>initWithMorph:
        |    |                    |                              65.1%
{15414ms} GLMSmalltalkEditor(TextEditor)>>resetState
        |    |                    |                                65.1%
{15414ms} GLMSmalltalkEditor(TextEditor)>>paragraph
        |    |                    |                                  65.1%
{15414ms} GLMTextMorphForEditView(TextMorphForEditView)>>paragraph
        |    |                    |
 65.1% {15414ms} GLMTextMorphForEditView(TextMorph)>>paragraph
        |    |                    |
 65.1% {15414ms} Paragraph>>compose:style:from:in:
        |    |                    |
 65.1% {15414ms} Paragraph>>composeAll
        |    |                    |
 65.1% {15414ms}
Paragraph>>multiComposeLinesFrom:to:delta:into:priorLines:atY:
        |    |                    |
   65.1% {15414ms}
TextComposer>>multiComposeLinesFrom:to:delta:into:priorLi...extStyle:text:container:wantsColumnBreaks:
        |    |                    |
     65.1% {15414ms} TextComposer>>composeAllLines
        |    |                    |
       65.1% {15414ms} TextComposer>>composeOneLine
        |    |                    |
         65.1% {15398ms} TextComposer>>composeAllRectangles:
        |    |                    |
           65.0% {15386ms} TextComposer>>composeEachRectangleIn:
        |    |                    |
             64.9% {15369ms}
MultiCompositionScanner>>composeFrom:inRectangle:firstLine:leftSide:rightSide:
        |    |                    |
               63.9% {15116ms} Text class>>fromString:
        |    |                    |
                 63.3% {14992ms} primitives
        |    |                  7.2% {1702ms}
LazyTabGroupMorph(Morph)>>privateFullBounds
        |    |                    7.2% {1702ms}
LazyTabGroupMorph(Morph)>>submorphBounds
        |    |                      7.2% {1702ms}
PanelMorph(Morph)>>fullBounds
        |    |                        7.2% {1702ms}
PanelMorph(Morph)>>doLayoutIn:
        |    |                          7.2% {1702ms}
TableLayout>>layout:in:
        |    |                            7.2% {1700ms}
TableLayout>>layoutTopToBottom:in:
        |    |                              7.2% {1700ms}
GLMPluggableTextMorph(Morph)>>layoutInBounds:
        |    |                                7.2% {1700ms}
GLMPluggableTextMorph(Morph)>>bounds:
        |    |                                  7.2% {1700ms}
GLMPluggableTextMorph(PluggableTextMorph)>>extent:
        |    |                                    7.2% {1696ms}
GLMTextMorphForEditView(TextMorph)>>extent:
        |    |                                      7.2% {1696ms}
GLMTextMorphForEditView(TextMorph)>>installEditorToReplace:
        |    |                                        7.2% {1696ms}
GLMSmalltalkEditor class(TextEditor class)>>forMorph:
        |    |                                          7.2% {1696ms}
GLMSmalltalkEditor(TextEditor)>>initWithMorph:
        |    |                                            7.2% {1696ms}
GLMSmalltalkEditor(TextEditor)>>resetState
        |    |                                              7.2% {1696ms}
GLMSmalltalkEditor(TextEditor)>>paragraph
        |    |                                                7.2% {1696ms}
GLMTextMorphForEditView(TextMorphForEditView)>>paragraph
        |    |                                                  7.2%
{1696ms} GLMTextMorphForEditView(TextMorph)>>paragraph
        |    |                                                    7.2%
{1696ms} Paragraph>>compose:style:from:in:
        |    |                                                      7.2%
{1696ms} Paragraph>>composeAll
        |    |                                                        7.2%
{1696ms} Paragraph>>multiComposeLinesFrom:to:delta:into:priorLines:atY:
        |    |
 7.2% {1696ms}
TextComposer>>multiComposeLinesFrom:to:delta:into:priorLi...extStyle:text:container:wantsColumnBreaks:
        |    |
 7.2% {1696ms} TextComposer>>composeAllLines
        |    |
 7.2% {1696ms} TextComposer>>composeOneLine
        |    |
   7.2% {1696ms} TextComposer>>composeAllRectangles:
        |    |
     7.2% {1694ms} TextComposer>>composeEachRectangleIn:
        |    |
       7.1% {1692ms}
MultiCompositionScanner>>composeFrom:inRectangle:firstLine:leftSide:rightSide:
        |    |
         6.9% {1629ms} Text class>>fromString:
        |    |
           6.8% {1621ms} primitives
        |  18.8% {4445ms}
GLMMorphicWindowRenderer(GLMMorphicWidgetRenderer)>>renderObject:
        |    18.8% {4445ms} GLMMorphicRenderer(GLMRenderer)>>render:
        |      18.8% {4445ms} GLMTabulator>>renderGlamorouslyOn:
        |        18.8% {4445ms} GLMMorphicRenderer>>renderTabulator:
        |          18.8% {4445ms} GLMMorphicTabulatorRenderer
class(GLMMorphicWidgetRenderer class)>>render:from:
        |            18.8% {4445ms} GLMMorphicTabulatorRenderer>>render:
        |              18.8% {4445ms}
GLMMorphicTabulatorRenderer>>renderCustomRow:ofPane:inUI:inBrowser:
        |                18.8% {4445ms}
GLMMorphicTabulatorRenderer(GLMMorphicWidgetRenderer)>>renderObject:
        |                  18.8% {4445ms}
GLMMorphicRenderer(GLMRenderer)>>render:
        |                    18.8% {4445ms} GLMPane>>renderGlamorouslyOn:
        |                      18.8% {4445ms}
GLMMorphicRenderer>>renderPane:
        |                        18.8% {4445ms} GLMMorphicPaneRenderer
class(GLMMorphicWidgetRenderer class)>>render:from:
        |                          18.8% {4445ms}
GLMMorphicPaneRenderer>>render:
        |                            18.8% {4445ms}
GLMMorphicPaneRenderer>>renderContainerFor:
        |                              18.8% {4443ms}
GLMMorphicPaneRenderer(GLMMorphicWidgetRenderer)>>renderWithTitleOrNil:
        |                                18.8% {4443ms}
GLMMorphicPaneRenderer(GLMMorphicWidgetRenderer)>>renderObject:
        |                                  18.8% {4443ms}
GLMMorphicRenderer(GLMRenderer)>>render:
        |                                    18.8% {4443ms}
GLMCompositePresentation>>renderGlamorouslyOn:
        |                                      18.8% {4443ms}
GLMTabbedArrangement>>renderGlamorouslyOn:
        |                                        18.8% {4443ms}
GLMMorphicRenderer>>renderTabbedCompositePresentation:
        |                                          18.8% {4443ms}
GLMMorphicTabbedRenderer class(GLMMorphicWidgetRenderer class)>>render:from:
        |                                            18.8% {4443ms}
GLMMorphicTabbedRenderer>>render:
        |                                              18.8% {4443ms}
GLMMorphicTabbedRenderer(GLMMorphicWidgetRenderer)>>renderWithTitleOrNil:
        |                                                18.8% {4441ms}
GLMMorphicTabbedRenderer(GLMMorphicWidgetRenderer)>>renderObject:
        |                                                  18.8% {4441ms}
GLMMorphicRenderer(GLMRenderer)>>render:
        |                                                    18.8% {4441ms}
GLMTextPresentation>>renderGlamorouslyOn:
        |                                                      18.8%
{4441ms} GLMMorphicRenderer>>renderTextPresentation:
        |                                                        18.8%
{4441ms} GLMMorphicTextRenderer class(GLMMorphicWidgetRenderer
class)>>render:from:
        |                                                          18.8%
{4441ms} GLMMorphicTextRenderer>>render:
        |                                                            18.8%
{4441ms} GLMMorphicTextRenderer>>textMorphForModel:
        |
 18.8% {4441ms} GLMPluggableTextMorph class(PluggableTextMorph
class)>>on:text:accept:readSelection:menu:
        |
 18.7% {4437ms}
GLMPluggableTextMorph(PluggableTextMorph)>>on:text:accept:readSelection:menu:
        |
 18.7% {4437ms} GLMPluggableTextMorph(PluggableTextMorph)>>setText:
        |
 18.7% {4437ms} GLMPluggableTextMorph(PluggableTextMorph)>>setTextBasic:
        |
   10.2% {2407ms} GLMTextMorphForEditView(TextMorph)>>contents:wrappedTo:
        |
     |10.2% {2407ms} GLMTextMorphForEditView(TextMorph)>>newContents:
        |
     |  10.2% {2407ms}
GLMTextMorphForEditView(TextMorphForEditView)>>paragraph
        |
     |    10.2% {2407ms} GLMTextMorphForEditView(TextMorph)>>paragraph
        |
     |      10.2% {2407ms} Paragraph>>compose:style:from:in:
        |
     |        10.2% {2407ms} Paragraph>>composeAll
        |
     |          10.2% {2407ms}
Paragraph>>multiComposeLinesFrom:to:delta:into:priorLines:atY:
        |
     |            10.2% {2407ms}
TextComposer>>multiComposeLinesFrom:to:delta:into:priorLi...extStyle:text:container:wantsColumnBreaks:
        |
     |              10.2% {2407ms} TextComposer>>composeAllLines
        |
     |                10.2% {2407ms} TextComposer>>composeOneLine
        |
     |                  10.2% {2403ms} TextComposer>>composeAllRectangles:
        |
     |                    10.1% {2401ms}
TextComposer>>composeEachRectangleIn:
        |
     |                      10.1% {2397ms}
MultiCompositionScanner>>composeFrom:inRectangle:firstLine:leftSide:rightSide:
        |
     |                        9.8% {2321ms} Text class>>fromString:
        |
     |                          9.7% {2299ms} primitives
        |
   8.6% {2030ms} GLMPluggableTextMorph(ScrollPane)>>setScrollDeltas
        |
     8.6% {2028ms} GLMPluggableTextMorph(ScrollPane)>>hideOrShowScrollBars
        |
       8.6% {2028ms} GLMPluggableTextMorph(ScrollPane)>>vHideOrShowScrollBar
        |
         8.6% {2028ms} GLMPluggableTextMorph(ScrollPane)>>vShowScrollBar
        |
           8.6% {2028ms}
GLMPluggableTextMorph(PluggableTextMorph)>>resetExtent
        |
             8.6% {2026ms}
GLMPluggableTextMorph(PluggableTextMorph)>>extent:
        |
               8.6% {2026ms} GLMTextMorphForEditView(TextMorph)>>extent:
        |
                 8.6% {2026ms}
GLMTextMorphForEditView(TextMorph)>>installEditorToReplace:
        |
                   8.6% {2026ms} GLMSmalltalkEditor class(TextEditor
class)>>forMorph:
        |
                     8.6% {2026ms}
GLMSmalltalkEditor(TextEditor)>>initWithMorph:
        |
                       8.6% {2026ms}
GLMSmalltalkEditor(TextEditor)>>resetState
        |
                         8.6% {2026ms}
GLMSmalltalkEditor(TextEditor)>>paragraph
        |
                           8.6% {2026ms}
GLMTextMorphForEditView(TextMorphForEditView)>>paragraph
        |
                             8.6% {2026ms}
GLMTextMorphForEditView(TextMorph)>>paragraph
        |
                               8.6% {2026ms}
Paragraph>>compose:style:from:in:
        |
                                 8.6% {2026ms} Paragraph>>composeAll
        |
                                   8.6% {2026ms}
Paragraph>>multiComposeLinesFrom:to:delta:into:priorLines:atY:
        |
                                     8.6% {2026ms}
TextComposer>>multiComposeLinesFrom:to:delta:into:priorLi...extStyle:text:container:wantsColumnBreaks:
        |
                                       8.6% {2026ms}
TextComposer>>composeAllLines
        |
                                         8.6% {2026ms}
TextComposer>>composeOneLine
        |
                                           8.6% {2024ms}
TextComposer>>composeAllRectangles:
        |
                                             8.5% {2020ms}
TextComposer>>composeEachRectangleIn:
        |
                                               8.5% {2016ms}
MultiCompositionScanner>>composeFrom:inRectangle:firstLine:leftSide:rightSide:
        |
                                                 8.3% {1956ms} Text
class>>fromString:
        |
                                                   8.2% {1950ms} primitives
      8.8% {2090ms} GLMSystemWindow(Morph)>>openInWorld
        8.8% {2090ms} GLMSystemWindow(SystemWindow)>>openInWorld:
          8.8% {2079ms} GLMSystemWindow(Morph)>>bounds:
            5.2% {1229ms} GLMSystemWindow(SystemWindow)>>position:
              |5.2% {1229ms} GLMSystemWindow(Morph)>>position:
              |  5.2% {1229ms} GLMSystemWindow(Morph)>>fullBounds
              |    5.2% {1229ms} GLMSystemWindow(Morph)>>doLayoutIn:
              |      5.2% {1229ms} GLMSystemWindow(Morph)>>privateFullBounds
              |        5.2% {1229ms} GLMSystemWindow(Morph)>>submorphBounds
              |          5.2% {1229ms} PanelMorph(Morph)>>fullBounds
              |            5.2% {1229ms} PanelMorph(Morph)>>doLayoutIn:
              |              5.2% {1229ms}
PanelMorph(Morph)>>privateFullBounds
              |                5.2% {1229ms}
PanelMorph(Morph)>>submorphBounds
              |                  5.2% {1229ms} PanelMorph(Morph)>>fullBounds
              |                    5.2% {1229ms}
PanelMorph(Morph)>>doLayoutIn:
              |                      5.2% {1229ms}
PanelMorph(Morph)>>privateFullBounds
              |                        5.2% {1229ms}
PanelMorph(Morph)>>submorphBounds
              |                          5.2% {1229ms}
LazyTabGroupMorph(Morph)>>fullBounds
              |                            5.2% {1229ms}
LazyTabGroupMorph(Morph)>>doLayoutIn:
              |                              5.2% {1229ms}
LazyTabGroupMorph(Morph)>>privateFullBounds
              |                                5.2% {1229ms}
LazyTabGroupMorph(Morph)>>submorphBounds
              |                                  5.2% {1229ms}
PanelMorph(Morph)>>fullBounds
              |                                    5.2% {1229ms}
PanelMorph(Morph)>>doLayoutIn:
              |                                      5.2% {1229ms}
TableLayout>>layout:in:
              |                                        5.2% {1227ms}
TableLayout>>layoutTopToBottom:in:
              |                                          5.2% {1227ms}
GLMPluggableTextMorph(Morph)>>layoutInBounds:
              |                                            5.2% {1227ms}
GLMPluggableTextMorph(Morph)>>bounds:
              |                                              5.2% {1227ms}
GLMPluggableTextMorph(PluggableTextMorph)>>extent:
              |                                                5.2%
{1225ms} GLMTextMorphForEditView(TextMorph)>>extent:
              |                                                  5.2%
{1225ms} GLMTextMorphForEditView(TextMorph)>>installEditorToReplace:
              |                                                    5.2%
{1225ms} GLMSmalltalkEditor class(TextEditor class)>>forMorph:
              |                                                      5.2%
{1225ms} GLMSmalltalkEditor(TextEditor)>>initWithMorph:
              |                                                        5.2%
{1225ms} GLMSmalltalkEditor(TextEditor)>>resetState
              |
 5.2% {1225ms} GLMSmalltalkEditor(TextEditor)>>paragraph
              |
 5.2% {1225ms} GLMTextMorphForEditView(TextMorphForEditView)>>paragraph
              |
 5.2% {1225ms} GLMTextMorphForEditView(TextMorph)>>paragraph
              |
   5.2% {1225ms} Paragraph>>compose:style:from:in:
              |
     5.2% {1225ms} Paragraph>>composeAll
              |
       5.2% {1225ms}
Paragraph>>multiComposeLinesFrom:to:delta:into:priorLines:atY:
              |
         5.2% {1225ms}
TextComposer>>multiComposeLinesFrom:to:delta:into:priorLi...extStyle:text:container:wantsColumnBreaks:
              |
           5.2% {1225ms} TextComposer>>composeAllLines
              |
             5.2% {1225ms} TextComposer>>composeOneLine
              |
               5.2% {1225ms} TextComposer>>composeAllRectangles:
              |
                 5.2% {1225ms} TextComposer>>composeEachRectangleIn:
              |
                   5.2% {1225ms}
MultiCompositionScanner>>composeFrom:inRectangle:firstLine:leftSide:rightSide:
              |
                     5.0% {1187ms} Text class>>fromString:
              |
                       5.0% {1177ms} primitives
            3.6% {850ms} GLMSystemWindow>>extent:
              3.6% {850ms} GLMSystemWindow(Morph)>>fullBounds
                3.6% {850ms} GLMSystemWindow(Morph)>>doLayoutIn:
                  3.6% {850ms} GLMSystemWindow(Morph)>>privateFullBounds
                    3.6% {850ms} GLMSystemWindow(Morph)>>submorphBounds
                      3.6% {850ms} PanelMorph(Morph)>>fullBounds
                        3.6% {850ms} PanelMorph(Morph)>>doLayoutIn:
                          3.6% {850ms} PanelMorph(Morph)>>privateFullBounds
                            3.6% {850ms} PanelMorph(Morph)>>submorphBounds
                              3.6% {850ms} PanelMorph(Morph)>>fullBounds
                                3.6% {850ms} PanelMorph(Morph)>>doLayoutIn:
                                  3.6% {850ms}
PanelMorph(Morph)>>privateFullBounds
                                    3.6% {850ms}
PanelMorph(Morph)>>submorphBounds
                                      3.6% {850ms}
LazyTabGroupMorph(Morph)>>fullBounds
                                        3.6% {850ms}
LazyTabGroupMorph(Morph)>>doLayoutIn:
                                          3.6% {850ms}
LazyTabGroupMorph(Morph)>>privateFullBounds
                                            3.6% {850ms}
LazyTabGroupMorph(Morph)>>submorphBounds
                                              3.6% {850ms}
PanelMorph(Morph)>>fullBounds
                                                3.6% {850ms}
PanelMorph(Morph)>>doLayoutIn:
                                                  3.6% {850ms}
TableLayout>>layout:in:
                                                    3.6% {850ms}
TableLayout>>layoutTopToBottom:in:
                                                      3.6% {848ms}
GLMPluggableTextMorph(Morph)>>layoutInBounds:
                                                        3.6% {848ms}
GLMPluggableTextMorph(Morph)>>bounds:
                                                          3.6% {848ms}
GLMPluggableTextMorph(PluggableTextMorph)>>extent:
                                                            3.6% {848ms}
GLMTextMorphForEditView(TextMorph)>>extent:
                                                              3.6% {848ms}
GLMTextMorphForEditView(TextMorph)>>installEditorToReplace:
                                                                3.6%
{848ms} GLMSmalltalkEditor class(TextEditor class)>>forMorph:
                                                                  3.6%
{848ms} GLMSmalltalkEditor(TextEditor)>>initWithMorph:
                                                                    3.6%
{848ms} GLMSmalltalkEditor(TextEditor)>>resetState
                                                                      3.6%
{848ms} GLMSmalltalkEditor(TextEditor)>>paragraph
3.6% {848ms} GLMTextMorphForEditView(TextMorphForEditView)>>paragraph
3.6% {848ms} GLMTextMorphForEditView(TextMorph)>>paragraph
3.6% {848ms} Paragraph>>compose:style:from:in:
  3.6% {848ms} Paragraph>>composeAll
    3.6% {848ms}
Paragraph>>multiComposeLinesFrom:to:delta:into:priorLines:atY:
      3.6% {848ms}
TextComposer>>multiComposeLinesFrom:to:delta:into:priorLi...extStyle:text:container:wantsColumnBreaks:
        3.6% {848ms} TextComposer>>composeAllLines
          3.6% {846ms} TextComposer>>composeOneLine
            3.6% {846ms} TextComposer>>composeAllRectangles:
              3.6% {844ms} TextComposer>>composeEachRectangleIn:
                3.6% {844ms}
MultiCompositionScanner>>composeFrom:inRectangle:firstLine:leftSide:rightSide:
                  3.4% {807ms} Text class>>fromString:
                    3.4% {802ms} primitives
**Leaves**
*96.5% {22842ms} Text class>>fromString:*
**Memory**
old -4,940,088 bytes
young +69,144 bytes
used -4,870,944 bytes
free -1,051,976 bytes
**GCs**
full 3 totalling 1,428ms (6.0% uptime), avg 476.0ms
incr 16030 totalling 15,162ms (64.0% uptime), avg 1.0ms
tenures 42 (avg 381 GCs/tenure)
root table 0 overflows