Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Suggestion: Refactor NinjaTrader to utilize Collections.Generic over Collections

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

    Suggestion: Refactor NinjaTrader to utilize Collections.Generic over Collections

    Reading thru Jon Skeet's book, C# in Depth, I've learned that its more advantageous to use System.Collections.Generics with collections (introduced in C# 2) vs. relying on just System.Collections (C# 1 technology). This is partcularly important when working with value types in your collections (e.g., int, double) - the more strongly typed generic collections (e.g., List<double>) will perform much better than a simple ArrayList for example as no boxing/unboxing will be needed behind the scenes.

    Please consider revamping NinjaTrader's codebase to make use of System.Collections.Generic vs. System.Collections. It should be more performant. A search thru NT 7 beta 14 code yields only @VolumeProfile.cs as making use of System.Collections.Generic whereas the following all use the older/slower System.Collections: @BuySellVolume.cs, @Swing.cs, @T3.cs, @ZigZag.cs, @BarsTypes.cs, @ChartStyles.cs, @TextImportType.cs. I'm sure other collections code is used behind the NinjaTrader engine and would hope that this would too be improved to help the overall speediness of NT.

    Quote from Skeet's book:

    We’ve seen three main benefits to generics: compile-time type safety, performance, and code expressiveness. Being able to get the IDE and compiler to validate your code early is certainly a good thing, but it’s arguable that more is to be gained from tools providing intelligent options based on the types involved than the actual “safety” aspect.

    Performance is improved most radically when it comes to value types, which no longer need to be boxed and unboxed when they’re used in strongly typed generic APIs, particularly the generic collection types provided in .NET 2.0. Performance with reference types is usually improved but only slightly.

    Your code is able to express its intention more clearly using generics—instead of a comment or a long variable name required to describe exactly what types are involved, the details of the type itself can do the work. Comments and variable names can often become inaccurate over time, as they can be left alone when code is changed—but the type information is “correct” by definition.
    http://stackoverflow.com/questions/5...n-net-obsolete

    JD

    #2
    Hello JD,

    Thank you for your feedback.

    I will forward this on to my development team for further consideration.
    KyleNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ETFVoyageur, Today, 07:05 PM
    0 responses
    4 views
    0 likes
    Last Post ETFVoyageur  
    Started by Orion815, 05-02-2024, 08:39 AM
    2 responses
    17 views
    0 likes
    Last Post Orion815  
    Started by suroot, 02-25-2017, 04:43 AM
    11 responses
    2,549 views
    0 likes
    Last Post Zilvercat  
    Started by Rogers101, 05-05-2024, 11:30 AM
    16 responses
    50 views
    0 likes
    Last Post Rogers101  
    Started by ninza33, Today, 12:31 PM
    2 responses
    12 views
    0 likes
    Last Post ninza33
    by ninza33
     
    Working...
    X