Friday, October 31, 2014

Comparing code using WPF Perforate and Visual Profiler


For INPC code vs non standard code, there are some steps we can follow:
        private double? _q;
        public double? Qty
        {
          ... NotifyPropertyChanged(this,"Qty");
        }

        private double? _q;
        public double? Qty
        {
            get { return GetQty(0); }
            set { _bidQtys[0] = value; }  // by adding NotifyPropertyChanged(this,"Qty") here speed will pick  up to standard INPC

(1) generate stressfull/human data 1ms, 10ms 250ms and bind to WPF Xaml UI
            d = Observable.Interval(TimeSpan.FromMilliseconds(1)).Delay(TimeSpan.FromSeconds(20)).Subscribe((ms) =>
            {
                Random r = new Random();
                for (int i = 0; i < FakeData.Count; i++)
                {
                    FakeData[i].Qty = -1000 * r.NextDouble();

(2) Perforator:FRPS/DRAR higher=> data updates faster (Key Observation: INPC has 9x FRPS than non-standard that use intermediate storage
(3) VisualProfiler CPU %
 DispatcherInvoke -- Dispatcher Operation,  Increasing to high=> buggy code, e.g too many timer pushing UI

 Rendering Thread --- Unmanaged render pass (Brushed, tessalation, call DirectX), find only the visual element and draws 

the whole window at a 60 FPS as default, popularly called as Composition Thread , Graphics acceleration uses Channel 

Protocol to communicate with the other thread. High and increasing % => need to Profile to feed XPerf, GPUViwer, WPA, 

etc in Windows Performance ToolKit.

 Layout ---measure/arrange passes higher => variable/Compute control size, fast changing text, bad GPU/Box.

(4) 1ms -- most stressful  10ms -- Physical limit 16ms per frame =60 FRPS, 250 Human eyeball, Win8 App Fast= 100-200ms

No comments: