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 bortz, 11-06-2023, 08:04 AM
    47 responses
    1,610 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    9 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    19 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    6 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    22 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X