This patch increases the efficiency of bounded strings by removing an unnecessary default. No change in functional behavior.
Tested on x86_64-pc-linux-gnu, committed on trunk 2012-03-07 Bob Duff <d...@adacore.com> * a-strsup.ads, a-stwisu.ads, a-stzsup.ads (Super_String): Remove default initial value for Data. It is no longer needed because "=" now composes properly for untagged records. This default has caused efficiency problems.
Index: a-strsup.ads =================================================================== --- a-strsup.ads (revision 185043) +++ a-strsup.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2003-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -43,7 +43,10 @@ type Super_String (Max_Length : Positive) is record Current_Length : Natural := 0; - Data : String (1 .. Max_Length) := (others => ASCII.NUL); + Data : String (1 .. Max_Length); + -- A previous version had a default initial value for Data, which is no + -- longer necessary, because "=" now composes properly for untagged + -- records. Leaving it out is more efficient. end record; -- Type Bounded_String in Ada.Strings.Bounded.Generic_Bounded_Length is -- derived from this type, with the constraint of the maximum length. Index: a-stwisu.ads =================================================================== --- a-stwisu.ads (revision 185043) +++ a-stwisu.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2003-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -46,7 +46,10 @@ type Super_String (Max_Length : Positive) is record Current_Length : Natural := 0; - Data : Wide_String (1 .. Max_Length) := (others => Wide_NUL); + Data : Wide_String (1 .. Max_Length); + -- A previous version had a default initial value for Data, which is no + -- longer necessary, because "=" now composes properly for untagged + -- records. Leaving it out is more efficient. end record; -- Ada.Strings.Wide_Bounded.Generic_Bounded_Length.Wide_Bounded_String is -- derived from this type, with the constraint of the maximum length. Index: a-stzsup.ads =================================================================== --- a-stzsup.ads (revision 185043) +++ a-stzsup.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2003-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -47,8 +47,10 @@ type Super_String (Max_Length : Positive) is record Current_Length : Natural := 0; - Data : Wide_Wide_String (1 .. Max_Length) := - (others => Wide_Wide_NUL); + Data : Wide_Wide_String (1 .. Max_Length); + -- A previous version had a default initial value for Data, which is no + -- longer necessary, because "=" now composes properly for untagged + -- records. Leaving it out is more efficient. end record; -- Wide_Wide_Bounded.Generic_Bounded_Length.Wide_Wide_Bounded_String is -- derived from this type, with the constraint of the maximum length.