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

Performance difference in OI10

This is just a curious observation worthy of comment ;)

I have code that will add text to every item in the tree.
In OI9, I've found that it is actually ~2x faster to set the OLE.ItemData[key] property each time for every key in a loop, rather than just change the itemList array and Set_property once on OLE.ItemList.
In OI10 it's the other way around. It's 2x faster just to change the itemList array and set that property once.

I've ended up with portable code like this:
redraw = Set_Property( treeCtrl, 'OLE.Redraw', 0) items = get_property( treeCtrl, 'OLE.ItemList') newItems = items For each item in items setting iPos name = item<0, SRPtree.itemList.data$> : ' [': item<0, SRPtree.itemList.class$>:']' If isOI10 then // faster in OI10 newItems< iPos, SRPtree.itemList.data$> = name end else // This is MUCH faster in OI9 than constructing for one Set_Property call for large lists Call Set_Property_Only( treeCtrl, 'OLE.ItemData[': item<0, SRPtree.itemList.key$>:']', name) End Next item If isOI10 then Call Set_property_only( treeCtrl, 'OLE.ItemList', newItems) ;// faster in OI10 Call Set_Property_Only( treeCtrl, 'OLE.Redraw', redraw)

I wonder where the difference is - OI's Set_Property handling, or 64bit SRPcontrols ?

Cheers, M@

Comments

  • Ballpark, how many items in the list before you notice the difference?

    Is it the set_property itemlist that has the noticeable difference?

    Or you haven't benchmarked to that level and you're referring to the block of code as a whole?
  • edited September 12
    This is surprising. There's definitely something strange going on if OI 9 is that much slower when using ItemList. I'm curious too how big the list is and what the actual benchmarks are. SRP_Stopwatch to satisfy our curiousity?
  • Yeah, I used TimeGetTime() in my tests. The list has 10,735 items in it.

    Here are ballpark average timings:
  • Further to this, there's a case where I need to get the ItemExpanded[key] property for every item in the list. For this same list, in OI9 it takes ~3,000 ticks whereas in OI10 it takes ~16,000 !

    The trouble is, there doesn't seem to be a way to get the ItemExpanded properties in an array for all items in one get_property() call?
  • Ok, 10,000 items is far far more items than I expect to ever have in a tree, so it probably won't affect me.

    But, you've got me curious... :)

    I'm still wondering about the actual itemlist call itself though.
    If you start your benchmark immediately before the set_property and stop immediately after, is there a significant difference in that alone?

    srp_stopwatch("start", "SET_ITEMLIST")
    Call Set_property_only( treeCtrl, 'OLE.ItemList', newItems)
    srp_stopwatch("stop", "SET_ITEMLIST")
  • Just on setting the ItemList property itself, there's not a lot of difference.
    OI9 ~800 ticks; OI10 ~1000
  • So that would appear to not be the problem, but it may be indicative. If setting the itemlist is fractionally slower in 10 than in 9 yet is still the faster approach in 10, perhaps itemdata is also fractionally slower in 10 and you're seeing a compounding effect over 10,000 iterations.

    Now I'd be wondering how long each of the last few iterations of Call Set_Property_Only( treeCtrl, 'OLE.ItemData[': item<0, SRPtree.itemList.key$>:']', name) take in each of 9 and 10.

    I mean, the timings suggest that concatenating of the 10,000 item string in 9 is significantly slower than in 10.
    But also, that repeatedly accessing the ItemData property in 10 is significantly slower than in 9.
  • edited September 13
    I also wonder if this might be beneficial in both cases

    SRP FastArray

    In theory that would enable you to run just one set of code and not an if 9 else scenario
  • Matt,

    Here’s where I think the slowdowns are happening.
    1. Updating NewItems with angle brackets is very slow. It is causing your loop to copy all ten thousand items ten thousand times.
    2. Calling ItemData for each item is slow. Even though it’s faster in OI 9, we can do better.
    3. The ItemList property actually deletes all items and recreates them anew, so that’s why it takes a full second or so all by itself. We don’t want to replace these items, we want to update them.
    I’ve created a new version (4.2.5.12) of SRPControls and SRPControls64. In this version, you can pass “*” or “LIST” as a key. For example:

    Items = Get_Property(TreeCtrl, “OLE.ItemText[*]”)

    This will get you an @FM delimited list of key-value pairs. Each value is ItemKey : @VM : Value. In the above example, the value will be the text. You can do this for ItemEnabled and any other indexed item property.

    Furthermore, you can set the item by passing it a list of key value pairs, like so:

    Set_Property(TreeCtrl, “OLE.ItemText[*]”, NewItems)

    So, here’s a more optimized loop (untested):

    redraw = Set_Property( treeCtrl, 'OLE.Redraw', 0) items = get_property( treeCtrl, 'OLE.ItemList') newItems = "" For each item in items setting iPos name = item<0, SRPtree.itemList.data$> : ' [': item<0, SRPtree.itemList.class$>:']' newItems := item<0, SRPtree.itemlist.key$> : @VM : name : @FM Next item newItems[-1, 1] = "" Set_property_only( treeCtrl, 'OLE.ItemData[*]', newItems) Call Set_Property_Only( treeCtrl, 'OLE.Redraw', redraw)

    Any and all feedback is welcome.
  • edited September 13
    On a side matter.
    Your 'official' release of srpcontrols is showing version of 4.2.4, you are showing this updated version as 4.2.5.12, which is nowhere near where I would expect the current release to be of 4.2.5.11

    What is the situation in this regard?
  • Your 'official' release of srpcontrols is showing version of 4.2.4, you are showing this updated version as 4.2.5.12, which is nowhere near where I would expect the current release to be of 4.2.5.11

    The 4th position is never displayed on our site. We refer to this as our build number, and it is for internal purposes. Kevin will at times note the build number so users can confirm if they are using the correct build. Otherwise, when comparing versions you would normally only compare the first three positions (e.g., 4.2.4 vs. 4.2.5). So in that regard the versions are not as far off as you might think.

    Having said that, we do acknowledge that we have not officially released 4.2.5, but we plan to do so shortly One reason why the build number will be high before the product is released is because we are still doing internal testing or we are waiting for a customer to give us feedback on an early release.
  • Yes, I'm overdue on an official release. Once this feature is vetted, I'll document and get out there.
  • Even though it’s faster in OI 9, we can do better

    Love it!
  • Hi Kevin,
    I’ve created a new version (4.2.5.12) of SRPControls and SRPControls64. In this version, you can pass “*” or “LIST” as a key

    Nice! This new [*] key reference for all (or a list of) items is faaaaantasic!!



    Definitely needed for getting ItemExpanded in OI10.

    Thanks very much :),
    M@
  • Yes, I'm overdue on an official release. Once this feature is vetted, I'll document and get out there.


    Thank you Don & Kevin
Sign In or Register to comment.