mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Replace the sorted array of GUC variables with a hash table.
This gets rid of bsearch() in favor of hashed lookup. The main advantage is that it becomes far cheaper to add new GUCs, since we needn't re-sort the pointer array. Adding N new GUCs had been O(N^2 log N), but now it's closer to O(N). We need to sort only in SHOW ALL and equivalent functions, which are hopefully not performance-critical to anybody. Also, merge GetNumConfigOptions() into get_guc_variables(), because in a world where the set of GUCs isn't fairly static you really want to consider those two results as tied together not independent. Discussion: https://postgr.es/m/2982579.1662416866@sss.pgh.pa.us
This commit is contained in:
@@ -49,11 +49,10 @@ GucInfoMain(void)
|
||||
int numOpts,
|
||||
i;
|
||||
|
||||
/* Initialize the guc_variables[] array */
|
||||
/* Initialize the GUC hash table */
|
||||
build_guc_variables();
|
||||
|
||||
guc_vars = get_guc_variables();
|
||||
numOpts = GetNumConfigOptions();
|
||||
guc_vars = get_guc_variables(&numOpts);
|
||||
|
||||
for (i = 0; i < numOpts; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user