aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Roche <roche@adacore.com>2018-07-16 14:08:27 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-07-16 14:08:27 +0000
commite05a1ce7113ba87b45bb6c950a8ae0bf56c536e3 (patch)
tree9e64765503469eb32e3d386b0858566f4c462e69
parent0150d9a1cd06feebd2e8efa56e364c8f377fb633 (diff)
downloadgcc-e05a1ce7113ba87b45bb6c950a8ae0bf56c536e3.zip
gcc-e05a1ce7113ba87b45bb6c950a8ae0bf56c536e3.tar.gz
gcc-e05a1ce7113ba87b45bb6c950a8ae0bf56c536e3.tar.bz2
[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 <roche@adacore.com> 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
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/libgnat/a-strunb.adb4
-rw-r--r--gcc/ada/libgnat/a-strunb__shared.adb4
3 files changed, 9 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 6e53729..d7063ae 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-16 Nicolas Roche <roche@adacore.com>
+
+ * 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 <ebotcazou@adacore.com>
* 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 530550d..da5e2b5 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 21827ed..0e060e3 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