Changeset: a7d1d7a7aa65 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a7d1d7a7aa65
Modified Files:
        .github/workflows/linux.yml
        MonetDB.spec
        NT/mksqlwxs.py
        README.rst
        cmake/monetdb-findpackages.cmake
        debian/control
        documentation/source/build.rst
        gdk/CMakeLists.txt
        gdk/gdk_atoms.c
        gdk/gdk_atoms.h
        gdk/gdk_hash.c
        gdk/gdk_hash.h
        gdk/gdk_private.h
        gdk/gdk_string.c
        monetdb5/mal/CMakeLists.txt
        monetdb5/tools/CMakeLists.txt
        sql/backends/monet5/CMakeLists.txt
        tools/monetdbe/CMakeLists.txt
        tools/mserver/mserver5.c
Branch: default
Log Message:

Replaced our internal atom hashes with xxhash.
On Fedora, you need to install xxhash-devel.
On Debian or Ubuntu, you need to install libxxhash-dev.
On Windows, you need to install pkgconf and xxhash (using vcpkg).
On Darwin, you need to install pkgconf and xxhash (using brew).


diffs (truncated from 759 to 300 lines):

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -82,7 +82,7 @@ jobs:
         if: runner.os == 'Linux'
 
       - name: brew packages
-        run: brew install bison
+        run: brew install bison pkgconf xxhash
         if: runner.os == 'macOS'
 
       - name: make MonetDB on macos
@@ -116,7 +116,7 @@ jobs:
       - name: choco packages
         run: |
           choco install winflexbison3
-          vcpkg install libiconv bzip2 libxml2 pcre2 zlib getopt 
+          vcpkg install libiconv bzip2 libxml2 pcre2 zlib getopt pkgconf xxhash
         if: runner.os == 'Windows'
 
       - name: make MonetDB on Windows
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -119,6 +119,7 @@ BuildRequires: pkgconfig(libpcre2-8)
 %endif
 BuildRequires: pkgconfig(zlib)
 BuildRequires: pkgconfig(liblz4) >= 1.8
+BuildRequires: pkgconfig(libxxhash)
 # optional packages:
 # BuildRequires: pkgconfig(cmocka)      # -DWITH_CMOCKA=ON
 # BuildRequires: pkgconfig(gdal)        # -DSHP=ON
diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py
--- a/NT/mksqlwxs.py
+++ b/NT/mksqlwxs.py
@@ -152,16 +152,17 @@ def main():
                rf'bin\monetdbsql-{version}.dll',
                rf'bin\stream-{version}.dll',
                rf'bin\mutils-{version}.dll',
-               vcpkg.format(r'bin\iconv-2.dll'),
                vcpkg.format(r'bin\bz2.dll'),
                vcpkg.format(r'bin\charset-1.dll'), # for iconv-2.dll
                vcpkg.format(r'bin\getopt.dll'),
+               vcpkg.format(r'bin\iconv-2.dll'),
                vcpkg.format(r'bin\libcrypto-3{}.dll'.format(libcrypto)),
+               vcpkg.format(r'bin\liblzma.dll'),
                vcpkg.format(r'bin\libssl-3{}.dll'.format(libcrypto)),
                vcpkg.format(r'bin\libxml2.dll'),
                vcpkg.format(r'bin\lz4.dll'),
-               vcpkg.format(r'bin\liblzma.dll'),
                vcpkg.format(r'bin\pcre2-8.dll'),
+               vcpkg.format(r'bin\xxhash.dll'),
                vcpkg.format(r'bin\z.dll')])
     id = comp(debug, id, 14,
               [r'bin\mclient.pdb',
@@ -213,14 +214,15 @@ def main():
                rf'lib\monetdbsql-{version}.lib',
                rf'lib\stream-{version}.lib',
                rf'lib\mutils-{version}.lib',
-               vcpkg.format(r'lib\iconv.lib'),
                vcpkg.format(r'lib\bz2.lib'),
                vcpkg.format(r'lib\charset.lib'),
                vcpkg.format(r'lib\getopt.lib'),
+               vcpkg.format(r'lib\iconv.lib'),
                vcpkg.format(r'lib\libxml2.lib'),
                vcpkg.format(r'lib\lz4.lib'),
                vcpkg.format(r'lib\lzma.lib'),
                vcpkg.format(r'lib\pcre2-8.lib'),
+               vcpkg.format(r'lib\xxhash.lib'),
                vcpkg.format(r'lib\z.lib')])
     print(r'            </Directory>')
     print(r'            <Directory Id="share" Name="share">')
diff --git a/README.rst b/README.rst
--- a/README.rst
+++ b/README.rst
@@ -94,7 +94,8 @@ Required and Optional Packages
 ..............................
 
 On Fedora, the following packages are required:
-``bison``, ``cmake``, ``gcc``, ``pkgconf``, ``python3``.
+``bison``, ``cmake``, ``gcc``, ``pkgconf``, ``python3``,
+``xxhash-devel``.
 
 The following packages are optional but recommended:
 ``bzip2-devel``, ``lz4-devel``, ``openssl-devel``, ``pcre2-devel``,
@@ -107,11 +108,12 @@ The following packages are optional:
 ``valgrind-devel``.
 
 On Ubuntu and Debian the following packages are required:
-``bison``, ``cmake``, ``gcc``, ``pkg-config``, ``python3``.
+``bison``, ``cmake``, ``gcc``, ``pkg-config``, ``python3``,
+``libxxash-dev``.
 
 The following packages are optional but recommended:
-``libbz2-dev``, ``liblz4-dev``, ``libpcre2-dev``, ``libreadline-dev``,
-``liblzma-dev``, ``libssl-dev``, ``zlib1g-dev``.
+``libbz2-dev``, ``liblz4-dev``, ``liblzma-dev``, ``libpcre2-dev``,
+``libreadline-dev``, ``libssl-dev``, ``zlib1g-dev``.
 
 The following packages are optional:
 ``libasan5``, ``libcfitsio-dev``, ``libcmocka-dev``,
diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake
--- a/cmake/monetdb-findpackages.cmake
+++ b/cmake/monetdb-findpackages.cmake
@@ -12,6 +12,13 @@
 find_package(BISON 3.0 REQUIRED)
 find_package(Iconv)
 find_package(Threads)
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(PC_XXHASH REQUIRED libxxhash)
+find_library(XXHASH_LIBRARIES NAMES xxhash
+  HINTS
+  ${PC_XXHASH_LIBDIR}
+  ${PC_XXHASH_LIBRARY_DIRS}
+)
 
 if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
   find_package(Python3 COMPONENTS Interpreter Development)
diff --git a/debian/control b/debian/control
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Vcs-Hg: https://dev.monetdb.org/hg/Monet
 Build-Depends: debhelper-compat (= 12), cmake (>= 3.12), bison,
  libbz2-dev, libcurl4-gnutls-dev, libgeos-dev (>= 3.10.0),
  libpcre2-dev, libreadline-dev, liblzma-dev, liblz4-dev (>= 1.8.0),
- libxml2-dev, pkg-config,
+ libxml2-dev, pkg-config, libxxash-dev,
  python3,
  unixodbc-dev, zlib1g-dev,
  libcfitsio-dev, libssl-dev (>= 1.1.1)
diff --git a/documentation/source/build.rst b/documentation/source/build.rst
--- a/documentation/source/build.rst
+++ b/documentation/source/build.rst
@@ -114,7 +114,7 @@ Start cmd.exe in "Run as administrator" 
   vcpkg integrate install
   # needed for 64 bits (with the available python being 64 bit this is needed)
   set VCPKG_DEFAULT_TRIPLET=x64-windows
-  vcpkg install libiconv bzip2 geos libxml2 pcre2 zlib getopt openssl
+  vcpkg install libiconv bzip2 geos libxml2 pcre2 zlib getopt openssl pkgconf 
xxhash
 
 To compile MonetDB (as normal user)::
 
diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt
--- a/gdk/CMakeLists.txt
+++ b/gdk/CMakeLists.txt
@@ -113,6 +113,7 @@ target_link_libraries(bat
   monetdb_config_header
   moptions
   mutils
+  ${XXHASH_LIBRARIES}
   $<$<BOOL:${OPENSSL_FOUND}>:OpenSSL::SSL>
   $<$<BOOL:${RTREE_FOUND}>:rtree::rtree>
   $<$<NOT:$<PLATFORM_ID:Windows>>:m>
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -145,62 +145,6 @@ hgeEq(const hge *l, const hge *r)
 #endif
 
 /*
- * @- inline hash routines
- * Return some positive integer derived from one atom value.
- */
-static BUN
-bteHash(const bte *v)
-{
-       return (BUN) mix_bte(*(const unsigned char *) v);
-}
-
-static BUN
-shtHash(const sht *v)
-{
-       return (BUN) mix_sht(*(const unsigned short *) v);
-}
-
-static BUN
-intHash(const int *v)
-{
-       return (BUN) mix_int(*(const unsigned int *) v);
-}
-
-static BUN
-lngHash(const lng *v)
-{
-       return (BUN) mix_lng(*(const ulng *) v);
-}
-
-#ifdef HAVE_HGE
-static BUN
-hgeHash(const hge *v)
-{
-       return (BUN) mix_hge(*(const uhge *) v);
-}
-#endif
-
-static BUN
-fltHash(const flt *v)
-{
-       if (is_flt_nil(*v))
-               return (BUN) mix_int(GDK_int_min);
-       if (*v == 0)
-               return (BUN) mix_int(0);
-       return (BUN) mix_int(*(const unsigned int *) v);
-}
-
-static BUN
-dblHash(const dbl *v)
-{
-       if (is_dbl_nil(*v))
-               return (BUN) mix_lng(GDK_lng_min);
-       if (*v == 0)
-               return (BUN) mix_lng(0);
-       return (BUN) mix_lng(*(const ulng *) v);
-}
-
-/*
  * @+ Standard Atoms
  */
 
@@ -1341,12 +1285,6 @@ UUIDfromString(allocator *ma, const char
        return -1;
 }
 
-static BUN
-UUIDhash(const void *v)
-{
-       return mix_uuid((const uuid *) v);
-}
-
 static void *
 UUIDread(allocator *ma, void *U, size_t *dstlen, stream *s, size_t cnt)
 {
@@ -1494,12 +1432,6 @@ INET4fromString(allocator *ma, const cha
        return -1;
 }
 
-static BUN
-INET4hash(const void *v)
-{
-       return intHash(v);
-}
-
 static void *
 INET4read(allocator *ma, void *U, size_t *dstlen, stream *s, size_t cnt)
 {
@@ -1817,12 +1749,6 @@ INET6fromString(allocator *ma, const cha
        return svalue_len;
 }
 
-static BUN
-INET6hash(const void *v)
-{
-       return mix_inet6(v);
-}
-
 static void *
 INET6read(allocator *ma, void *U, size_t *dstlen, stream *s, size_t cnt)
 {
@@ -1999,13 +1925,6 @@ BLOBdel(Heap *h, var_t *idx)
        HEAP_free(h, *idx);
 }
 
-static BUN
-BLOBhash(const void *B)
-{
-       const blob *b = B;
-       return (BUN) b->nitems;
-}
-
 static void *
 BLOBread(allocator *ma, void *A, size_t *dstlen, stream *s, size_t cnt)
 {
@@ -2457,7 +2376,7 @@ atomDesc BATatoms[MAXATOMS] = {
                .atomWrite = UUIDwrite,
                .atomCmp = UUIDcompare,
                .atomEqual = UUIDequal,
-               .atomHash = UUIDhash,
+               .atomHash = uuidHash,
        },
        [TYPE_inet4] = {
                .name = "inet4",
@@ -2471,7 +2390,7 @@ atomDesc BATatoms[MAXATOMS] = {
                .atomWrite = INET4write,
                .atomCmp = INET4compare,
                .atomEqual = INET4equal,
-               .atomHash = INET4hash,
+               .atomHash = inet4Hash,
        },
        [TYPE_inet6] = {
                .name = "inet6",
@@ -2485,7 +2404,7 @@ atomDesc BATatoms[MAXATOMS] = {
                .atomWrite = INET6write,
                .atomCmp = INET6compare,
                .atomEqual = INET6equal,
-               .atomHash = INET6hash,
+               .atomHash = inet6Hash,
        },
        [TYPE_str] = {
                .name = "str",
@@ -2516,7 +2435,7 @@ atomDesc BATatoms[MAXATOMS] = {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to