Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Performance issue

I seem to have having some performance issues which I dont think I had previously with this control. V 4.1.8
There is not a lot of data, 20 columns and 50 rows.

I traced it so some code below.

CALL Set_Property(TableControl,"REDRAW",0)
ColumnList=Get_Property(TableControl,"OLE.ColumnList")
ColCount=DCOUNT(ColumnList,@FM)
For Column=1 TO ColCount
ColName=ColumnList
LOCATE ColName IN ITEM<11> USING @VM SETTING POS THEN
Width =ITEM<12,POS>
Visible=ITEM<13,POS>
CALL Set_Property(TableControl,"OLE.ColumnWidth[":Column:"]",Width)
CALL Set_Property(TableControl,"OLE.ColumnVisible[":Column:"]",Visible)
END
NEXT Column

The two set properties for Width and Visible seem to take a while, maybe 5-10 seconds. Even with Redraw set to zero.

Any issues or thoughts please.

Colin

Comments

  • I want to confirm a couple of things:
    1. You are loading the data into the ReportTable before setting the column widths?
    2. Did you actually set a benchmark (e.g., using the SRP_Stopwatch utility) to isolate the time it takes to set the ColumnVisible properties?
  • 1. Yes the data is already loaded.
    The code is adjusting the info on the screen based on view settings.

    2. I just ran a benchmark test




    CALL SRP_Stopwatch("Reset")
    CALL SRP_Stopwatch("Start", "SRP")

    CALL Set_Property(TableControl,"REDRAW",0)
    ColumnList=Get_Property(TableControl,"OLE.ColumnList")
    ColCount=DCOUNT(ColumnList,@FM)
    For Column=1 TO ColCount
    ColName=ColumnList
    LOCATE ColName IN ITEM<11> USING @VM SETTING POS THEN
    Width =ITEM<12,POS>
    Visible=ITEM<13,POS>
    CALL Set_Property(TableControl,"OLE.ColumnWidth[":Column:"]",Width)
    CALL Set_Property(TableControl,"OLE.ColumnVisible[":Column:"]",Visible)
    END
    NEXT Column

    CALL SRP_Stopwatch("Stop", "SRP")
    CALL SRP_Stopwatch("Show", "SRP")

  • I agree that time seems excessively long, but would you humor me and place the Start and Stop calls just before and just after the ColumnWidth property settings? This will provide better isolation and it will also give us an average for each iteration of your loop.

    Just out of curiosity, does the data have to be loaded before you set the column widths?
  • Is this the exact code as the following doesn't make sense to ME.

    ColumnList=Get_Property(TableControl,"OLE.ColumnList")
    ColCount=DCOUNT(ColumnList,@FM) This tells me that there are @fm in ColumnList

    ColName=ColumnList therefore Colname contains @fm values
    LOCATE ColName IN ITEM<11> USING @VM SETTING POS THEN if so then how would this worrk
  • Results with the timer around the property settings.
    I was wrong, there are actually 56 columns.



    I also commented out the setting of the Width, and it seems like the Visible property is the one causing most of the degrade.

    The data has to be there, it is populated on create, and then views manipulate the content, sort, group, columns etc.


    CALL SRP_Stopwatch("Reset")

    CALL Set_Property(TableControl,"REDRAW",0)
    ColumnList=Get_Property(TableControl,"OLE.ColumnList")
    ColCount=DCOUNT(ColumnList,@FM)

    For Column=1 TO ColCount
    ColName=ColumnList
    LOCATE ColName IN ITEM<11> USING @VM SETTING POS THEN
    Width =ITEM<12,POS>
    Visible=ITEM<13,POS>
    CALL SRP_Stopwatch("Start", "SRP")
    CALL Set_Property(TableControl,"OLE.ColumnWidth[":Column:"]",Width)
    CALL Set_Property(TableControl,"OLE.ColumnVisible[":Column:"]",Visible)
    CALL SRP_Stopwatch("Stop", "SRP")
    END
    NEXT Column

    CALL SRP_Stopwatch("Show", "SRP")
  • Barry

    The code is OK, but the paste into the formum seemed to have changed

    ColName = ColumnList < Column , 1 >

    It is as above, I added spaces all over the place in this post so that the forum shows.
  • @BarryStevens - I'm wondering if the code didn't post correctly due to markup issues. Otherwise, you are correct, ColName isn't getting populated correctly.
  • Don, see post from Barry and my response.
    Seems the posting is not exact for the code pasted.
  • It must be ok, as the stopwatch is being execute in the 'then' path
  • @ColinRule - You can use the code paragraph feature to format your code:
    CALL Set_Property(TableControl,"REDRAW",0) ColumnList=Get_Property(TableControl,"OLE.ColumnList") ColCount=DCOUNT(ColumnList,@FM) For Column=1 TO ColCount ColName=ColumnList<Column,1> LOCATE ColName IN ITEM<11> USING @VM SETTING POS THEN Width =ITEM<12,POS> Visible=ITEM<13,POS> CALL Set_Property(TableControl,"OLE.ColumnWidth[":Column:"]",Width) CALL Set_Property(TableControl,"OLE.ColumnVisible[":Column:"]",Visible) END NEXT Column
  • ooh, so you can, now posted as exact.
    I did not know how to do that.

    CALL SRP_Stopwatch("Reset") CALL Set_Property(TableControl,"REDRAW",0) ColumnList=Get_Property(TableControl,"OLE.ColumnList") ColCount=DCOUNT(ColumnList,@FM) For Column=1 TO ColCount ColName=ColumnList<Column,1> LOCATE ColName IN ITEM<11> USING @VM SETTING POS THEN Width =ITEM<12,POS> Visible=ITEM<13,POS> CALL SRP_Stopwatch("Start", "SRP") CALL Set_Property(TableControl,"OLE.ColumnWidth[":Column:"]",Width) CALL Set_Property(TableControl,"OLE.ColumnVisible[":Column:"]",Visible) CALL SRP_Stopwatch("Stop", "SRP") END NEXT Column CALL SRP_Stopwatch("Show", "SRP")
  • Well, I'm doubtful the OpenInsight REDRAW property is useful with the SRP ReportTable control. As far as I know, the SRP ReportTable does not have its own Redraw property the way the SRP EditTable does. If you are changing the visible settings of 56 columns at runtime then perhaps the lag isn't as excessive as I first imagined. However, I would assume that a true Redraw property for this control would help. We'll look into this and get back to you.
  • Another thought...instead of updating these properties individually, why not just update the ColumnList property array in your loop and just do one ColumnList Set_Property?
  • Thanks Don.
    What bemuses me though is that I think this is recent. I would have noticed this on the earlier versions, ie when I wrote this code in the first place.
  • Don, fair call. I will try setting the Column List property and advise.
    I am assuming the data remains in tact and associated with the revised ColumnList property.
  • You could try to upgrade to 4.0.11 and see if that makes a difference (but I'm doubtful).
  • Instead of REDRAW (which is an OI property), try setting OLE.AutoPopulate to 0 and back to 1 when finished.
  • I think Don's on the money with the columnlist suggestion but fwiw, the reporttable Autopopulate property serves a similar function to the redraw property on other controls
  • @KevinFournier, you must type faster
  • This property only affects adding and removing rows. It will have no affect when modifying existing rows.

    This is why I didn't suggest the AutoPopulate property. I didn't think it was applicable.
  • Thanks everyone for the fantastic turnaround.
    Some interesting results here.
    I used the OLE.AutoPopulate and it did not make much difference, but with the OI REDRAW disabled I can see the columns changing, and slowly.

    I then included both the REDRAW and OLE.AutoPopulate together and it works fine now. 32 ms for the 56 updates.
    This seems like a sort of logical progression. Problem solved, essentially the change views is instantaneous.


    CALL Set_Property(TableControl,"REDRAW",0) CALL Set_Property(TableControl,"OLE.AutoPopulate",0) CALL Set_Property(TableControl,"OLE.AutoPopulate",1) CALL Set_Property(TableControl,"REDRAW",1)

Sign In or Register to comment.