]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Efficiency improvement in bounded ordered containers
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Aug 2019 09:49:07 +0000 (09:49 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Aug 2019 09:49:07 +0000 (09:49 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@274724 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/libgnat/a-cborma.adb
gcc/ada/libgnat/a-cborse.adb

index 3db5d5ca06f01035a168fbd413637a0bd3f3bf46..f8f43c00441c2913b77ec35b15aefef12ea00cc0 100644 (file)
@@ -1,3 +1,9 @@
+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
index a7969fe8a0dd26df284499b4c8975963d3331588..55be7ad0327882b2f661863f647aeae907d0d05a 100644 (file)
@@ -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;
 
    -----------
index 363351a4933bdba8b17363cec3e7ee34d544ecf9..9fdba269d2813ce7a6d28ac784cba762cb4ac1d0 100644 (file)
@@ -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;
 
    -----------