postgresql/src/include/port
Thomas Munro 15c9ac3629 Optimize pg_readv/pg_pwritev single vector case.
For the trivial case of iovcnt == 1, kernels are measurably slower at
dealing with the more complex arguments of preadv/pwritev than the
equivalent plain old pread/pwrite.  The overheads are worth it for
iovcnt > 1, but for 1 let's just redirect to the cheaper calls.  While
we could leave it to callers to worry about that, we already have to
have our own pg_ wrappers for portability reasons so it seems
reasonable to centralize this knowledge there (thanks to Heikki for this
suggestion).  Try to avoid function call overheads by making them
inlinable, which might also allow the compiler to avoid the branch in
some cases.  For systems that don't have preadv and pwritev (currently:
Windows and [closed] Solaris), we might as well pull the replacement
functions up into the static inline functions too.

Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com
2023-11-29 17:19:25 +13:00
..
atomics Fix fallback implementation for pg_atomic_test_set_flag(). 2023-11-15 15:04:18 -06:00
win32 Remove configure probe for netinet/tcp.h. 2022-08-18 16:31:11 +12:00
win32_msvc windows: msvc: Define STDIN/OUT/ERR_FILENO. 2022-07-18 17:21:54 -07:00
aix.h Attempt to work around a 32bit xlc compiler bug from a different place. 2015-08-08 01:19:02 +02:00
atomics.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
cygwin.h Simplify declaring variables exported from libpgcommon and libpgport. 2021-11-29 11:00:00 -05:00
darwin.h Refer to OS X as "macOS", except for the port name which is still "darwin". 2016-09-25 15:40:57 -04:00
freebsd.h Improve the naming in wal_sync_method code. 2023-10-13 15:16:45 -05:00
linux.h Improve the naming in wal_sync_method code. 2023-10-13 15:16:45 -05:00
netbsd.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
openbsd.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
pg_bitutils.h Bring some MSVC asserts in line with other platforms 2023-07-31 14:46:21 +07:00
pg_bswap.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_crc32c.h Use native CRC instructions on 64-bit LoongArch 2023-08-10 11:36:15 +07:00
pg_iovec.h Optimize pg_readv/pg_pwritev single vector case. 2023-11-29 17:19:25 +13:00
pg_lfind.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_pthread.h Add missing pthread_barrier_t. 2021-03-10 17:44:04 +13:00
simd.h Fix various typos in code and tests 2023-02-09 14:43:53 +09:00
solaris.h Remove obsolete HAVE_BUGGY_SOLARIS_STRTOD 2020-08-15 11:27:41 +02:00
win32.h mingw: Define PGDLLEXPORT as __declspec (dllexport) as done for msvc 2022-09-30 10:50:05 -07:00
win32_port.h Remove wal_sync_method=fsync_writethrough on Windows. 2023-07-14 12:30:13 +12:00
win32ntdll.h Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00