aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2019-08-20 09:49:07 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-20 09:49:07 +0000
commitcbdb0df117deb12a8e7d63e1cf2b53415b8e92e2 (patch)
tree48fafff9537ec815f3c50814341616701dd5e90e /gcc
parent94f76dc10cdbdfcd5255b0c0cf15ab9056c0c514 (diff)
downloadgcc-cbdb0df117deb12a8e7d63e1cf2b53415b8e92e2.zip
gcc-cbdb0df117deb12a8e7d63e1cf2b53415b8e92e2.tar.gz
gcc-cbdb0df117deb12a8e7d63e1cf2b53415b8e92e2.tar.bz2
[Ada] Efficiency improvement in bounded ordered containers
The Delete operations in the bounded ordered containers have been substantially sped up. No change in semantics, so no test. 2019-08-20 Bob Duff <duff@adacore.com> gcc/ada/ * libgnat/a-cborma.adb, libgnat/a-cborse.adb (Clear): Repeatedly call Delete. This avoids clearing the free list, which substantially speeds up future Delete operations. From-SVN: r274724
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/libgnat/a-cborma.adb4
-rw-r--r--gcc/ada/libgnat/a-cborse.adb4
3 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 3db5d5c..f8f43c0 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,11 @@
2019-08-20 Bob Duff <duff@adacore.com>
+ * libgnat/a-cborma.adb, libgnat/a-cborse.adb (Clear): Repeatedly
+ call Delete. This avoids clearing the free list, which
+ substantially speeds up future Delete operations.
+
+2019-08-20 Bob Duff <duff@adacore.com>
+
* sem_ch13.adb (Component_Order_Check): New procedure to check
for out-of-order clauses.
* warnsw.ads, warnsw.adb: New -gnatw_r switch.
diff --git a/gcc/ada/libgnat/a-cborma.adb b/gcc/ada/libgnat/a-cborma.adb
index a7969fe..55be7ad 100644
--- a/gcc/ada/libgnat/a-cborma.adb
+++ b/gcc/ada/libgnat/a-cborma.adb
@@ -374,7 +374,9 @@ package body Ada.Containers.Bounded_Ordered_Maps is
procedure Clear (Container : in out Map) is
begin
- Tree_Operations.Clear_Tree (Container);
+ while not Container.Is_Empty loop
+ Container.Delete_Last;
+ end loop;
end Clear;
-----------
diff --git a/gcc/ada/libgnat/a-cborse.adb b/gcc/ada/libgnat/a-cborse.adb
index 363351a4..9fdba26 100644
--- a/gcc/ada/libgnat/a-cborse.adb
+++ b/gcc/ada/libgnat/a-cborse.adb
@@ -374,7 +374,9 @@ package body Ada.Containers.Bounded_Ordered_Sets is
procedure Clear (Container : in out Set) is
begin
- Tree_Operations.Clear_Tree (Container);
+ while not Container.Is_Empty loop
+ Container.Delete_Last;
+ end loop;
end Clear;
-----------