Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Speed test: faster way to create DxBrush

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Speed test: faster way to create DxBrush

    I need to chose in what form to hold colors for create DxBrush in custom plotting:

    (pseudo code)
    Code:
    Windows.Media.Brush wm_brush = new SoilidColorBrush();
    DxBrush dx_brush = wm_brush.ToDxBrush();
    or

    Code:
    Color4 color4 = new Color4();
    DxBrush dx_brush = new DxSolidColorBrush( color4 );

    here are results in milliseconds for 10 000 create \ dispose:.


    From Dx_Color4: 006.2
    From Wm_Brush: 029.7

    From Dx_Color4: 003.0
    From Wm_Brush: 014.5

    From Dx_Color4: 010.5
    From Wm_Brush: 033.5

    From Dx_Color4: 006.0
    From Wm_Brush: 026.0

    From Dx_Color4: 011.0
    From Wm_Brush: 036.5

    From Dx_Color4: 005.3
    From Wm_Brush: 017.3

    From Dx_Color4: 012.0
    From Wm_Brush: 035.0

    From Dx_Color4: 010.5
    From Wm_Brush: 033.7

    From Dx_Color4: 005.0
    From Wm_Brush: 015.0

    From Dx_Color4: 003.0
    From Wm_Brush: 014.0


    Creating DxBrush from Color4 looks about 3 times faster.
    Attached Files
    Last edited by fx.practic; 08-01-2017, 03:12 AM.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Hello fx.practic,

    Thanks for opening the thread and providing sample code to answer the question! It is good to know that better performance can be achieved with Color4 colors.

    If you have any questions that I may answer, please don't hesitate to ask.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    561 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    325 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    547 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X