Thread
Commits
-
pgbench: replace run-time string comparisons with an enum identifier.
- f987f83de20a 11.0 landed
-
pgbench - use enum for meta commands
Fabien COELHO <coelho@cri.ensmp.fr> — 2017-09-23T03:45:35Z
Minor code enhancement. While having a look at adding if/elif/else/endif to pgbench, and given the current gset/cset added meta commands in cf queue, it occured to me that repeated string comparisons to check for the various meta commands is neither efficient nor readable. Use an enum instead, which are extensively used already for other similar purposes. -- Fabien.
-
Re: pgbench - use enum for meta commands
Pavel Stehule <pavel.stehule@gmail.com> — 2017-09-23T04:16:35Z
2017-09-23 5:45 GMT+02:00 Fabien COELHO <coelho@cri.ensmp.fr>: > > Minor code enhancement. > > While having a look at adding if/elif/else/endif to pgbench, and given the > current gset/cset added meta commands in cf queue, it occured to me that > repeated string comparisons to check for the various meta commands is > neither efficient nor readable. Use an enum instead, which are extensively > used already for other similar purposes. > +1 Pavel > -- > Fabien. > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers > >
-
Re: pgbench - use enum for meta commands
Aleksandr Parfenov <a.parfenov@postgrespro.ru> — 2017-11-02T14:29:18Z
The following review has been posted through the commitfest application: make installcheck-world: tested, passed Implements feature: tested, passed Spec compliant: tested, passed Documentation: tested, passed Hi, Looks good to me. The only thing I'm not quite sure about is a comment "which meta command ...". Maybe it's better to write it without question word, something like "meta command identifier..."? The new status of this patch is: Ready for Committer
-
Re: pgbench - use enum for meta commands
Fabien COELHO <coelho@cri.ensmp.fr> — 2017-11-02T16:48:56Z
> The only thing I'm not quite sure about is a comment "which meta command > ...". Maybe it's better to write it without question word, something > like "meta command identifier..."? Ok. I agree. Updated version attached. I also added a const on a function parameter. Just a note about the motivation: I want to add the same "\if" syntax added to psql, but it requires to look at the meta command in a number of places to manage the automaton status, and the strcmp solution looked both ugly and inefficient. So this small refactoring is just a preliminary to the "\if" patch, some day, after this one get committed, if it gets committed. > The new status of this patch is: Ready for Committer Thanks for the review. -- Fabien.
-
Re: pgbench - use enum for meta commands
Fabien COELHO <coelho@cri.ensmp.fr> — 2017-11-02T16:50:52Z
> Updated version attached. <sigh>. Here is the patch. Sorry for the noise. -- Fabien.
-
Re: pgbench - use enum for meta commands
Aleksandr Parfenov <a.parfenov@postgrespro.ru> — 2017-11-02T17:06:49Z
On Thu, 2 Nov 2017 17:50:52 +0100 (CET) Fabien COELHO <coelho@cri.ensmp.fr> wrote: > > Updated version attached. > > <sigh>. Here is the patch. Sorry for the noise. > Everything alright. Patch is ready for commiter. -- Aleksandr Parfenov Postgres Professional: http://www.postgrespro.com Russian Postgres Company
-
Re: pgbench - use enum for meta commands
Tom Lane <tgl@sss.pgh.pa.us> — 2017-11-02T22:34:06Z
Fabien COELHO <coelho@cri.ensmp.fr> writes: > [ pgbench-enum-meta-2.patch ] Pushed with some trivial cosmetic adjustments (pgindent changed it more than I did). regards, tom lane
-
Re: pgbench - use enum for meta commands
Fabien COELHO <coelho@cri.ensmp.fr> — 2017-11-03T05:36:52Z
>> [ pgbench-enum-meta-2.patch ] > > Pushed with some trivial cosmetic adjustments (pgindent changed > it more than I did). Ok. Thanks. -- Fabien.