From: Nicolas Roche Date: Mon, 16 Jul 2018 14:08:27 +0000 (+0000) Subject: [Ada] Adjust growth factor from 1/32 to 1/2 for Unbounded_String X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e05a1ce7113ba87b45bb6c950a8ae0bf56c536e3;p=gcc.git [Ada] Adjust growth factor from 1/32 to 1/2 for Unbounded_String This will reduce significantly the number of allocations done when doing consecutive append operations. 2018-07-16 Nicolas Roche gcc/ada/ * libgnat/a-strunb.adb, libgnat/a-strunb__shared.adb: Adjust growth factor from 1/32 to 1/2 for Unbounded_String. From-SVN: r262697 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6e53729ecf7..d7063ae88a2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-07-16 Nicolas Roche + + * libgnat/a-strunb.adb, libgnat/a-strunb__shared.adb: Adjust growth + factor from 1/32 to 1/2 for Unbounded_String. + 2018-07-13 Eric Botcazou * gcc-interface/lang.opt (funsigned-char): New option. diff --git a/gcc/ada/libgnat/a-strunb.adb b/gcc/ada/libgnat/a-strunb.adb index 530550d6a1b..da5e2b5c604 100644 --- a/gcc/ada/libgnat/a-strunb.adb +++ b/gcc/ada/libgnat/a-strunb.adb @@ -763,13 +763,13 @@ package body Ada.Strings.Unbounded is (Source : in out Unbounded_String; Chunk_Size : Natural) is - Growth_Factor : constant := 32; + Growth_Factor : constant := 2; -- The growth factor controls how much extra space is allocated when -- we have to increase the size of an allocated unbounded string. By -- allocating extra space, we avoid the need to reallocate on every -- append, particularly important when a string is built up by repeated -- append operations of small pieces. This is expressed as a factor so - -- 32 means add 1/32 of the length of the string as growth space. + -- 2 means add 1/2 of the length of the string as growth space. Min_Mul_Alloc : constant := Standard'Maximum_Alignment; -- Allocation will be done by a multiple of Min_Mul_Alloc This causes diff --git a/gcc/ada/libgnat/a-strunb__shared.adb b/gcc/ada/libgnat/a-strunb__shared.adb index 21827ed6af4..0e060e3436e 100644 --- a/gcc/ada/libgnat/a-strunb__shared.adb +++ b/gcc/ada/libgnat/a-strunb__shared.adb @@ -36,13 +36,13 @@ package body Ada.Strings.Unbounded is use Ada.Strings.Maps; - Growth_Factor : constant := 32; + Growth_Factor : constant := 2; -- The growth factor controls how much extra space is allocated when -- we have to increase the size of an allocated unbounded string. By -- allocating extra space, we avoid the need to reallocate on every -- append, particularly important when a string is built up by repeated -- append operations of small pieces. This is expressed as a factor so - -- 32 means add 1/32 of the length of the string as growth space. + -- 2 means add 1/2 of the length of the string as growth space. Min_Mul_Alloc : constant := Standard'Maximum_Alignment; -- Allocation will be done by a multiple of Min_Mul_Alloc. This causes