On Tue, Jan 29, 2013 at 2:19 PM, Ben Coman <btc@openinworld.com> wrote:
Usman Bhatti wrote:
Hello,

I am trying to arrange two sets of nodes in verticalLineLayout with
Roassal, and within a set, the nodes are arranged in a gridLayout. The
script below allows works fine except that the execution time is too long
when the number of nodes is large and hence I am unable to achieve
multi-layout visualization for large number of nodes.

view := ROMondrianViewBuilder new.
view shape rectangle withoutBorder.
view node:#aaa forIt:[
view shape rectangle.
view nodes: (1 to: 10000).
view gridLayout.
].

view shape rectangle withoutBorder.
view node:#bbb forIt:[
view shape rectangle.
view nodes: (1 to: 1000).
view gridLayout.
].

view verticalLineLayout.

view open

Can you please have a look or could you suggest an alternate solution? I
have created my own custom layout but that is tied to the structure of my
nodes and hence not generic.

tx.
usman
 

I am probably breaking some rules by directly using some private parts of Roassal, but for 1000 items I managed to reduce the execution time from 3867 msec down to 38 msec, then also with 10000 items down to 182 msec.
The script at the bottom gives the following result for the standard operation of Roassal...
----
3857 tallies, 3867 msec.
65.1% {2518ms} ROGridLayout(ROLayout)>>applyOn:
 65.1% {2518ms} ROGridLayout(ROLayout)>>executeOnElements:
   65.1% {2518ms} ROGridLayout>>doExecute:
     65.1% {2517ms} RODirectLayoutTranslator>>translate:to:
       65.1% {2517ms} ROElement>>translateTo:
         65.1% {2516ms} ROElement>>translateBy:
           65.1% {2516ms} ROElement>>adjustSizeIfNecessary
             65.1% {2516ms} ROExtensibleParent>>on:
               65.1% {2516ms} ROAdjustSizeOfNesting class(ROAbstractAdjustSize class)>>on:
33.9% {1310ms} ROElement>>addedInAnElement:
 33.8% {1306ms} ROElement>>adjustSizeIfNecessary
----

Note that 98.9% of the time was spent in ROElement>>adjustSizeIfNecessary and ROAdjustSizeOfNesting class>>on:
ROAdjustSizeOfNesting is removed from the 1000 loop by including the two commented parts of the script, giving the following result...
----
38 tallies, 38 msec.
42.1% {16ms} ROGridLayout(ROLayout)>>applyOn:
 42.1% {16ms} ROGridLayout(ROLayout)>>executeOnElements:
   42.1% {16ms} ROGridLayout>>doExecute:
     36.8% {14ms} RODirectLayoutTranslator>>translate:to:
       36.8% {14ms} ROElement>>translateTo:
         34.2% {13ms} ROElement>>translateBy:
15.8% {6ms} ROElement(ROAbstractComponent)>>+
  15.8% {6ms} ROElement(ROAbstractComponent)>>addShape:
13.2% {5ms} ROElement class(ROAbstractComponent class)>>on:
  13.2% {5ms} ROElement>>initialize
10.5% {4ms} ROAdjustSizeOfNesting class>>getNewRectangleFor:
----

So here is the script for you to try. I have used 'raw' Roassal API rather than the Mondrian API since that is what I am more familiar with from working on my own application the past 9 months.   Its a bit more verbose but I feel I have more control and more insight into the architecture. ----

Thx for looking into it. But it seems that the number of input nodes is modest :-).
When there are 1K nodes, Mondrian DSL (with 794 msec) is performing better than the raw API (with 2105 msec). I didn't look in further details, may there is a difference into how the scripts are written. 

When I try to execute your script on 10K nodes, the execution of the script never returns so every time I have to forcefully stop the execution (remember, it was the same problem with my Mondrian script as well). To me, it seems that the nesting of large number of children nodes is not properly handled in Roassal.

Alex, do you want us to report Roassal-related bugs in the Moose issues list or you have a separate list for that? Even if these are not correctly immediately, there should be a place which contains the knowledge about the known issues in Roassal.

Usman

 
|view outer|
view := ROView new.
MessageTally spyOn:
[    2 timesRepeat:
   [    view add: (outer := ROElement new "resizeStrategy: ROFixedSizedParent new") + ROBorder .
       1 to: 1000 do:
       [    :node |
           outer add: (ROBorder elementOn: node) .
       ].
       ROGridLayout on: outer elements.
       "ROAdjustSizeOfNesting on: outer."
   ].
].
ROVerticalLineLayout on: view elements.
view open.
----

Apart from the obvious speed benefit, Alexandre can comment on how I'm abusing the architecture ;)

cheers -ben



_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev