Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit025c024

Browse files
committed
Speed up CRC calculation using slicing-by-8 algorithm.
This speeds up WAL generation and replay. The new algorithm issignificantly faster with large inputs, like full-page images or wheninserting wide rows. It is slower with tiny inputs, i.e. less than 10 bytesor so, but the speedup with longer inputs more than make up for that. Evensmall WAL records at least have 24 byte header in the front.The output is identical to the current byte-at-a-time computation, so thisdoes not affect compatibility. The new algorithm is only used for theCRC-32C variant, not the legacy version used in tsquery or the"traditional" CRC-32 used in hstore and ltree. Those are not as performancecritical, and are usually only applied over small inputs, so it seemsbetter to not carry around the extra lookup tables to speed up those rarecases.Abhijit Menon-Sen
1 parentcc761b1 commit025c024

File tree

7 files changed

+1246
-85
lines changed

7 files changed

+1246
-85
lines changed

‎config/c-compiler.m4

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,23 @@ fi])# PGAC_C_TYPES_COMPATIBLE
193193

194194

195195

196+
# PGAC_C_BUILTIN_BSWAP32
197+
# -------------------------
198+
# Check if the C compiler understands __builtin_bswap32(),
199+
# and define HAVE__BUILTIN_BSWAP32 if so.
200+
AC_DEFUN([PGAC_C_BUILTIN_BSWAP32],
201+
[AC_CACHE_CHECK(for__builtin_bswap32,pgac_cv__builtin_bswap32,
202+
[AC_TRY_COMPILE([static unsigned long int x = __builtin_bswap32(0xaabbccdd);],
203+
[],
204+
[pgac_cv__builtin_bswap32=yes],
205+
[pgac_cv__builtin_bswap32=no])])
206+
if test x"$pgac_cv__builtin_bswap32" = xyes ; then
207+
AC_DEFINE(HAVE__BUILTIN_BSWAP32,1,
208+
[Define to 1 if your compiler understands __builtin_bswap32.])
209+
fi])# PGAC_C_BUILTIN_BSWAP32
210+
211+
212+
196213
# PGAC_C_BUILTIN_CONSTANT_P
197214
# -------------------------
198215
# Check if the C compiler understands __builtin_constant_p(),

‎configure

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10332,6 +10332,36 @@ if test x"$pgac_cv__types_compatible" = xyes ; then
1033210332

1033310333
$as_echo"#define HAVE__BUILTIN_TYPES_COMPATIBLE_P 1">>confdefs.h
1033410334

10335+
fi
10336+
{$as_echo"$as_me:${as_lineno-$LINENO}: checking for __builtin_bswap32">&5
10337+
$as_echo_n"checking for __builtin_bswap32...">&6; }
10338+
if${pgac_cv__builtin_bswap32+:}false;then:
10339+
$as_echo_n"(cached)">&6
10340+
else
10341+
cat confdefs.h -<<_ACEOF >conftest.$ac_ext
10342+
/* end confdefs.h. */
10343+
static unsigned long int x = __builtin_bswap32(0xaabbccdd);
10344+
int
10345+
main ()
10346+
{
10347+
10348+
;
10349+
return 0;
10350+
}
10351+
_ACEOF
10352+
if ac_fn_c_try_compile"$LINENO";then:
10353+
pgac_cv__builtin_bswap32=yes
10354+
else
10355+
pgac_cv__builtin_bswap32=no
10356+
fi
10357+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10358+
fi
10359+
{$as_echo"$as_me:${as_lineno-$LINENO}: result:$pgac_cv__builtin_bswap32">&5
10360+
$as_echo"$pgac_cv__builtin_bswap32">&6; }
10361+
iftest x"$pgac_cv__builtin_bswap32" = xyes;then
10362+
10363+
$as_echo"#define HAVE__BUILTIN_BSWAP32 1">>confdefs.h
10364+
1033510365
fi
1033610366
{$as_echo"$as_me:${as_lineno-$LINENO}: checking for __builtin_constant_p">&5
1033710367
$as_echo_n"checking for __builtin_constant_p...">&6; }

‎configure.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,7 @@ PGAC_C_SIGNED
11851185
PGAC_C_FUNCNAME_SUPPORT
11861186
PGAC_C_STATIC_ASSERT
11871187
PGAC_C_TYPES_COMPATIBLE
1188+
PGAC_C_BUILTIN_BSWAP32
11881189
PGAC_C_BUILTIN_CONSTANT_P
11891190
PGAC_C_BUILTIN_UNREACHABLE
11901191
PGAC_C_VA_ARGS

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp