Mail archive
alpine-user

Re: [alpine-user] FYI: community/zstd binary much (up to 4x) slower than necessary

From: Natanael Copa <ncopa_at_alpinelinux.org>
Date: Fri, 16 Mar 2018 16:50:56 +0100

On Fri, 16 Mar 2018 16:37:41 +0100
Steffen Nurpmeso <steffen_at_sdaoden.eu> wrote:

> Hello.
>
> Natanael Copa <ncopa_at_alpinelinux.org> wrote:
> |On Tue, 13 Mar 2018 19:06:48 +0100
> |Steffen Nurpmeso <steffen_at_sdaoden.eu> wrote:
> |
> |> Hello, for your possible interest.
> |>
> |> In a thead for the LUGA(ustria) i eventually had to time some
> |> compression algorithms and wondered why zstd is so slow, but
> |> especially so the decompressing stage, which a key feature of this
> |> one. It turns out that the -Os compilation causes, well, drama-
> |> tical performance degradation. I compiled my own with -O3 and the
> |> difference is up to factor four. Just one example:
> ...
> |Are you compressing the same file? I see x4.txt, x5.txt avs x1.txt.
> |File content may make difference too.
>
> Yes, it was all the same. It was just an excerpt of that LUGA
> message, sorry.
>
> |> That makes me actually wonder how ports should deal with CFLAGS.
> |> Is it acceptable for a port to watch for compiler flags and set
> |> them, my MUA would go for PIE, relro and all that, then?
> |
> |I think if the difference is 4x then, yes, I think we should explicitly
> |set CFLAGS from aport with a reference on why. I do prefer -O2 over -O3
> |though, so It would be nice to see the numbers with -O2 and also what
> |the numbers are on different platforms.
> |
> |We already explicitly set -O2 for zlib, because its a case where we do
> |want trade more speed at the cost of size.
>
> I see. I only have control of x86 (with Linux) for now, i really
> have to do something about that at some day... With -O2:
>
> #?0[steffen_at_essex zstd]$ CFLAGS=-O2 make zstd
> ...
> #?0[steffen_at_essex zstd]$ ll zstd
> -rwxr-x--- 1 steffen steffen 582392 Mar 16 16:11 zstd*

...

>
> No difference with -O3, actually:
>
> #?0[steffen_at_essex zstd]$ CFLAGS=-O3 make zstd
> ...
> #?0[steffen_at_essex zstd]$ ll zstd
> -rwxr-x--- 1 steffen steffen 619296 Mar 16 16:17 zstd*

Yes, no big difference in performance -O2 vs -O3, but it gets bigger.

...

> But lots of difference for /usr/bin/zstd:
>
> #?0[steffen_at_essex zstd]$ ll /usr/bin/zstd
> -rwxr-xr-x 1 root root 382792 Dec 27 15:17 /usr/bin/zstd*

I assume that is with -Os.

I think this alone is good enough reason to force -O2.

Thanks!

-nc


---
Unsubscribe:  alpine-user+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-user+help_at_lists.alpinelinux.org
---
Received on Fri Mar 16 2018 - 16:50:56 GMT