From cbdb0df117deb12a8e7d63e1cf2b53415b8e92e2 Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Tue, 20 Aug 2019 09:49:07 +0000 Subject: [PATCH] [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 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 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/libgnat/a-cborma.adb | 4 +++- gcc/ada/libgnat/a-cborse.adb | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3db5d5ca06f..f8f43c00441 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-08-20 Bob Duff + + * 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 * sem_ch13.adb (Component_Order_Check): New procedure to check diff --git a/gcc/ada/libgnat/a-cborma.adb b/gcc/ada/libgnat/a-cborma.adb index a7969fe8a0d..55be7ad0327 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 363351a4933..9fdba269d28 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; ----------- -- 2.30.2