This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Ada] Efficiency improvement in bounded ordered containers
- From: Pierre-Marie de Rodat <derodat at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Bob Duff <duff at adacore dot com>
- Date: Tue, 20 Aug 2019 05:51:22 -0400
- Subject: [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.
Tested on x86_64-pc-linux-gnu, committed on trunk
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.
--- gcc/ada/libgnat/a-cborma.adb
+++ 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;
-----------
--- gcc/ada/libgnat/a-cborse.adb
+++ 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;
-----------