]> gcc.gnu.org Git - gcc.git/commit
[Ada] Single-element Append performance improvement
authorSteve Baird <baird@adacore.com>
Wed, 27 Jul 2022 00:17:17 +0000 (17:17 -0700)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 5 Sep 2022 07:21:06 +0000 (09:21 +0200)
commitcb6ff9e4198c6cd5abd915e271ea33d50f48b3d8
tree04ab8aeaeb3d457f77b98ed7bc8cf065f4a4cbad
parent66d4ff2658fc2d5115092da29249191feac75308
[Ada] Single-element Append performance improvement

Ada.Containers.Vectors has two Append procedures that take an
Element value; one takes a Count parameter and one does not
(the count is implicitly one for the latter). For the former version,
there was code that took a faster path if certain conditions were met
and otherwise took a slower path; one of the prerequisite conditions
for this was Count = 1. For the latter version, no such special-case
detection was performed; the more general code was always executed.
Move the special-case detection/handling code from the former version into
the latter and change the former version to simply call the latter version
if Count = 1. Also apply same change to Ada.Containers.Indefinite_Vectors.

gcc/ada/

* libgnat/a-coinve.adb, libgnat/a-convec.adb
(Append): If the Append that takes an Element and a Count is
called with Count = 1, then call the Append that does not take a
Count parameter; otherwise call the code that handles the general
case. Move the special case detection/handling code that was
formerly in that version of Append into the version that does not
take a Count parameter, so that now both versions get the
performance benefit.
gcc/ada/libgnat/a-coinve.adb
gcc/ada/libgnat/a-convec.adb
This page took 0.056139 seconds and 5 git commands to generate.