* [Ada] Efficiency improvement in bounded ordered containers
@ 2019-08-20 9:51 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2019-08-20 9:51 UTC (permalink / raw)
To: gcc-patches; +Cc: Bob Duff
[-- Attachment #1: Type: text/plain, Size: 402 bytes --]
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.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 740 bytes --]
--- 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;
-----------
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-08-20 9:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 9:51 [Ada] Efficiency improvement in bounded ordered containers Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).