Re: Small improvement to compactify_tuples
Claudio Freire <klaussfreire@gmail.com>
From: Claudio Freire <klaussfreire@gmail.com>
To: Юрий Соколов <funny.falcon@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Sokolov Yura <funny.falcon@postgrespro.ru>, Alvaro Herrera <alvherre@2ndquadrant.com>,
Heikki Linnakangas <hlinnaka@iki.fi>, PostgreSQL-Dev <pgsql-hackers@postgresql.org>
Date: 2017-11-07T15:12:02Z
Lists: pgsql-hackers
On Tue, Nov 7, 2017 at 11:42 AM, Юрий Соколов <funny.falcon@gmail.com> wrote: > > > 2017-11-07 17:15 GMT+03:00 Claudio Freire <klaussfreire@gmail.com>: >> Aside from requiring all that include magic, if you place specialized >> sort functions in a reusable header, using it is as simple as >> including the type-specific header (or declaring the type macros and >> including the template), and using them as regular functions. There's >> no runtime overhead involved, especially if you declare the comparison >> function as a macro or a static inline function. The sort itself can >> be declared static inline as well, and the compiler will decide >> whether it's worth inlining. > > Ok, if no one will complain against another one qsort implementation, > I will add template header for qsort. Since qsort needs insertion sort, > it will be in a same file. > Do you approve of this? > > With regards, > Sokolov Yura If you need it. I'm not particularly fond of writing code before it's needed. If you can measure the impact for that particular case where qsort might be needed, and it's a real-world case, then by all means. Otherwise, if it's a rarely-encountered corner case, I'd recommend simply calling the stdlib's qsort.
Commits
-
Avoid looping through line pointers twice in PageRepairFragmentation().
- a9169f0200fc 11.0 landed
-
Reduce pinning and buffer content locking for btree scans.
- 2ed5b87f96d4 9.5.0 cited
-
Speed up in-memory tuplesorting.
- 337b6f5ecf05 9.2.0 cited