Bug Report B203074
Visible to All Users

Performance impact with ConditionalAppearance

created 14 years ago

Hi Guys,
as already discussed here B202804 - i aslo face a performance problems with CA. I am facing this several months now, but never really had time to track it down. Actually i have a detailview, with an collection of lineitems. These are shown via an TreeListEditor in MasterDetail mode. Now when i create a new lineitem, the user assign can assighn a product. in the product setter there are heavy calculations happening, a lot of property changes occour(setting up prices, descriptions, special prices, calculate total price, and so on…). Currently, assigning an product can take up to 2.5 - 3 seconds. today i made a small test and did the following:

  1. a custom treelist editor where i disable appearance refresh:
        [ListEditor(typeof(ITreeNode), false)]
        public class VDTreeListEditor : TreeListEditor
        {
            public VDTreeListEditor(DevExpress.ExpressApp.Model.IModelListView model)
                : base(model) {
            }
            protected override void OnCustomizeAppearance(CustomizeAppearanceEventArgs args)
            {
                ////base.OnCustomizeAppearance(args);
            }
        }
  2. a controller which disables RefreshAppearanceController
         public class DisableAppearanceController : ObjectViewController
        {
            protected override void OnActivated()
            {
                base.OnActivated();
                this.Frame.GetController<RefreshAppearanceController>().Active.SetItemValue("Kill appearance", false);
            }
        }
    With these 2 changes, assigning an product will happen immediatly, now slow down. The problem, as far as i see, is that RefreshAppearanceController and TreeListEditor handle the both objectSpace.ObjectChanged event, which results in hundreds(or even more then thousand) of appearance refreshs during assigning an product.
    Of course - i need actually the CA since there are some appearance rules for the listview and detailview(2 rules for the listview, 2 rules for the detailview)
    Any help would be much appreciated!
Comments (3)
DevExpress Support Team 14 years ago

    Hi Noxe,
    I am afraid we cannot research this issue based on the information you provided. Could you please provide us with a small sample project, demonstrating this issue? We will research it and do our best to find a solution.
    Thanks,
    Michael.

    M M
    Martin Praxmarer - DevExpress MVP 14 years ago

      Mi Michael,
      attached is a sample and a video where i have build a master / detail - similar which i have in my application. please note that this is just a really simple example to show the behaviour. you see that without CA the properties are assigned immediatly, but when adding the CA module it takes up to 5 seconds… Please take also note how long it takes when you click on the "Detail" tab, this is not cause of CA - but i notice the same in my application for master/detail views.

      DevExpress Support Team 14 years ago

        Hi Noxe,
        We have researched this issue and found that it is caused by the fact that every property change raises an event and the CA module updates the view on every property change notification. We cannot ignore these notifications.
        To overcome this issue, you should suppress intermediate notifications and raise only a single notification when the batch modification is finished.

        1. Inherit your Master and Detail classes from the following base class:
        C#
        [NonPersistent] public class UpdatableBaseObject : BaseObject, ISupportUpdate { public UpdatableBaseObject(Session s) : base(s) { } private int guard = 0; protected override void TriggerObjectChanged(ObjectChangeEventArgs args) { if (guard > 0) return; base.TriggerObjectChanged(args); } public void BeginUpdate() { guard++; } public void EndUpdate() { if (--guard == 0) { TriggerObjectChanged(new ObjectChangeEventArgs(Session, this, ObjectChangeReason.Reset)); } } }
        1. Modify the Detail.PropertyNameString property setter as follows:
        C#
        private string _PropertyNameString; public string PropertyNameString { get { return this._PropertyNameString; } set { SetPropertyValue(Fields.PropertyNameString.PropertyName, ref this._PropertyNameString, value); if (!this.IsLoading) { Random rnd = new Random(); var watch = new System.Diagnostics.Stopwatch(); watch.Start(); BeginUpdate(); this.Master.BeginUpdate(); for (int i = 0; i < 10; i++) { this.SetMemberValue("DetailProperty" + i, rnd.Next(10000)); this.Master.SetMemberValue("MasterProperty" + i, rnd.Next(10000)); this._PropertyNameInt++; } this.Master.EndUpdate(); EndUpdate(); //OnChanged("PropertyNameInt"); watch.Stop(); this.InfoString = "Time: " + watch.Elapsed.ToString(); } } }

        Thanks,
        Michael.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.