Ada 95 Quality and Style Guide Chapter 10

Chapter 10: Improving Performance - TOC - 10.6 TYPES

10.6.1 Aggregates for Type Extensions

guideline

  • Use only simple aggregates when measured performance indicates.

  • example

       type Parent is tagged
          record
             C1 : Float;
             C2 : Float;
          end record;
    
       type Extension is new Parent with
          record
             C3 : Float;
             C4 : Float;
          end record;
    
       Parent_Var : Parent := (C1 => Float_Var1, C2 => Float_Var2);
       Exten_Var  : Extension;
       ...
       -- Simple aggregate
       -- (See ACES V2.0, test "a9_ob_simp_aggregate_02")
       Exten_Var := (C1 => Float_Var1, C2 => Float_Var2,
                     C3 => Float_Var3, C4 => Float_Var4);
       -- Extension aggregate
       -- (See ACES V2.0, test "a9_ob_ext_aggregate_02")
       Exten_Var := (Parent_Var with C3 => Float_Var3, C4 => Float_Var4);
    

    rationale

    Determine the impact of using extension aggregates. There may be a significant performance difference between evaluation of simple aggregates and evaluation of extension aggregates.


    < Previous Page Search Contents Index Next Page >
    1 2 3 4 5 6 7 8 9 10 11
    TOC TOC TOC TOC TOC TOC TOC TOC TOC TOC TOC
    Appendix References Bibliography