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:
I wonder where the difference is - OI's Set_Property handling, or 64bit SRPcontrols ?
Cheers, M@
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
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?
Here are ballpark average timings:
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?
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")
OI9 ~800 ticks; OI10 ~1000
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.
SRP FastArray
In theory that would enable you to run just one set of code and not an if 9 else scenario
Here’s where I think the slowdowns are happening.
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.
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?
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.
Love it!
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@
Thank you Don & Kevin