pgsql: Improve implementation of GEQO's init_tour() function.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve implementation of GEQO's init_tour() function.
Date: 2015-11-05 15:46:26
Message-ID: E1ZuMk6-0002Hm-V5@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve implementation of GEQO's init_tour() function.

Rather than filling a temporary array and then copying values to the
output array, we can generate the required random permutation in-place
using the Fisher-Yates shuffle algorithm. This is shorter as well as
more efficient than before. It's pretty unlikely that anyone would
notice a speed improvement, but shorter code is better.

Nathan Wagner, edited a bit by me

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/59464bd6f928ad0da30502cbe9b54baec9ca2c69

Modified Files
--------------
src/backend/optimizer/geqo/geqo_recombination.c | 44 ++++++++++-------------
1 file changed, 19 insertions(+), 25 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2015-11-05 17:21:26 pgsql: Pass extra data to bgworkers, and use this to fix parallel conte
Previous Message Peter Eisentraut 2015-11-05 02:52:19 pgsql: Update spelling of COPY options