~alpine/aports

[alpine-aports] [PATCH] community/zstd: fix ~15% speed degradation on x86*

alpine-mips-patches <info@mobile-stream.com>
Details
Message ID
<20181214074517.228DB645C0@mx12.valuehost.ru>
Sender timestamp
1544782088
DKIM signature
missing
Download raw message
Patch: +24 -6
This is the same memcpy()-in-hot-path xxHash problem as described
in community/xxhash commit message.

The bug makes "zstd -1" or "zstd -t" ~15% slower on x86_64 though
higher levels (>= 9) are almost unaffected.

Other aport changes:
 - make sure zlib/lzma/lz4 support is not compiled in automatically
   (status quo, just make it explicit);
 - re-enable armv7 since it is certainly well-supported by upstream,
   was disabled by some script in the first place and should not be
   affected by "Bus error" (i.e. some alignment problem) mentioned in
   commit 2bae66907...
 - use faster and shorter "make check" (unlike extensive "make test")
   on arm* builders.
---
 community/zstd/APKBUILD                        | 18 ++++++++++++------
 ...ift-XXH_FORCE_MEMORY_ACCESS-condition.patch | 12 ++++++++++++
 2 files changed, 24 insertions(+), 6 deletions(-)
 create mode 100644 community/zstd/lift-XXH_FORCE_MEMORY_ACCESS-condition.patch

diff --git a/community/zstd/APKBUILD b/community/zstd/APKBUILD
index 0c1b7ea2fd..796ebf3074 100644
--- a/community/zstd/APKBUILD
+++ b/community/zstd/APKBUILD
@@ -2,26 +2,31 @@
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=zstd
pkgver=1.3.7
pkgrel=0
pkgrel=1
pkgdesc="Zstandard - Fast real-time compression algorithm"
url="http://www.zstd.net"
arch="all !armhf !armv7"
arch="all !armhf"
license="BSD-3-Clause GPL-2.0-or-later"
checkdepends="file"
makedepends="grep"
subpackages="$pkgname-static $pkgname-libs $pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/facebook/zstd/archive/v$pkgver.tar.gz"
source="$pkgname-$pkgver.tar.gz::https://github.com/facebook/zstd/archive/v$pkgver.tar.gz
	lift-XXH_FORCE_MEMORY_ACCESS-condition.patch
	"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	unset CPPFLAGS
	make MOREFLAGS="-O2"
	make HAVE_PTHREAD=1 HAVE_ZLIB=0 HAVE_LZMA=0 HAVE_LZ4=0 MOREFLAGS="-O2"
}

check() {
	cd "$builddir"
	make test
	case "$CARCH" in
	arm*)	make check ;;
	*)	make test ;;
	esac
}

package() {
@@ -35,4 +40,5 @@ static() {
	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
}

sha512sums="b7a432b13e237ac1490cd82b87727f6a4385d5ea7b89f566dea61a3993e17909c03288f727326ada326e36eb47ea5f9eab67c097808ee42f52cc800a7f7e1738  zstd-1.3.7.tar.gz"
sha512sums="b7a432b13e237ac1490cd82b87727f6a4385d5ea7b89f566dea61a3993e17909c03288f727326ada326e36eb47ea5f9eab67c097808ee42f52cc800a7f7e1738  zstd-1.3.7.tar.gz
4e577dc44f7b870ef55e179865e03a924f1cab5307367658e011f9868ef82562ca299e31411ef2ea15f0ac4247bcc5ce013a5c716479e08b34d0229d896aefc8  lift-XXH_FORCE_MEMORY_ACCESS-condition.patch"
diff --git a/community/zstd/lift-XXH_FORCE_MEMORY_ACCESS-condition.patch b/community/zstd/lift-XXH_FORCE_MEMORY_ACCESS-condition.patch
new file mode 100644
index 0000000000..dc514a005c
--- /dev/null
+++ b/community/zstd/lift-XXH_FORCE_MEMORY_ACCESS-condition.patch
@@ -0,0 +1,12 @@
--- a/lib/common/xxhash.c
+++ b/lib/common/xxhash.c
@@ -52,8 +52,7 @@
 #ifndef XXH_FORCE_MEMORY_ACCESS   /* can be defined externally, on command line for example */
 #  if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) )
 #    define XXH_FORCE_MEMORY_ACCESS 2
-#  elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \
-  (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) ))
+#  elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || defined(__GNUC__)
 #    define XXH_FORCE_MEMORY_ACCESS 1
 #  endif
 #endif
-- 
2.19.2




---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)