Commit 15c9ac3
committed
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.com1 parent a60b8a5 commit 15c9ac3
File tree
7 files changed
+74
-120
lines changed- src
- include/port
- port
- tools/msvc
7 files changed
+74
-120
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16057 | 16057 | | |
16058 | 16058 | | |
16059 | 16059 | | |
16060 | | - | |
| 16060 | + | |
16061 | 16061 | | |
16062 | 16062 | | |
16063 | 16063 | | |
| |||
16070 | 16070 | | |
16071 | 16071 | | |
16072 | 16072 | | |
16073 | | - | |
16074 | | - | |
16075 | | - | |
16076 | | - | |
16077 | | - | |
16078 | | - | |
16079 | | - | |
16080 | | - | |
16081 | | - | |
16082 | | - | |
16083 | 16073 | | |
16084 | 16074 | | |
16085 | 16075 | | |
| |||
16092 | 16082 | | |
16093 | 16083 | | |
16094 | 16084 | | |
16095 | | - | |
16096 | | - | |
16097 | | - | |
16098 | | - | |
16099 | | - | |
16100 | | - | |
16101 | | - | |
16102 | | - | |
16103 | | - | |
16104 | | - | |
16105 | 16085 | | |
16106 | 16086 | | |
16107 | 16087 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1816 | 1816 | | |
1817 | 1817 | | |
1818 | 1818 | | |
1819 | | - | |
| 1819 | + | |
1820 | 1820 | | |
1821 | | - | |
1822 | | - | |
| 1821 | + | |
| 1822 | + | |
1823 | 1823 | | |
1824 | 1824 | | |
1825 | 1825 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | | - | |
40 | | - | |
| 40 | + | |
| 41 | + | |
41 | 42 | | |
42 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
45 | 55 | | |
46 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
47 | 75 | | |
| 76 | + | |
48 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
49 | 85 | | |
50 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
51 | 94 | | |
52 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
53 | 114 | | |
| 115 | + | |
54 | 116 | | |
55 | 117 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | 69 | | |
72 | 70 | | |
73 | 71 | | |
| |||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
0 commit comments